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) { // 你的代码 ........ });