angularJS頁面加載完成后調用,代碼如下
// 頁面加載完成后調用 $scope.$watch('$viewContentLoaded', function() { // 你的代碼 ........ });
循環結束后調用
首先,需要添加指令
.directive('onFinishRenderFilters', function($timeout) { return { restrict: 'A', link: function(scope, element, attr) { if(scope.$last === true) { $timeout(function() { scope.$emit('ngRepeatFinished'); }); } } }; });
html中添加指令的方法應該都會的~,如下:
循環結束后調用方法,代碼如下:
$scope.$on('ngRepeatFinished', function(ngRepeatFinishedEvent) { // 你的代碼 ........ });