View
<ul>
<li ng-repeat="item in items" on-finish-render="callMethod()">
dummy Text
</li>
</ul>
Directive
.directive('onFinishRender',['$timeout', '$parse', function ($timeout, $parse) {
return {
restrict: 'A',
link: function (scope, element, attr) {
if (scope.$last === true) {
$timeout(function () {
scope.$emit('ngRepeatFinished'); //事件通知
var fun = $scope.$eval(attrs.onFinishRender);
if(fun && typeof(fun)=='function'){
fun(); //回调函数
}
});
}
}
}
}])
事件处理
//捕获 emited event
$scope.$on('ngRepeatFinished', function(ngRepeatFinishedEvent) {
});
angular自定义指令
猜你喜欢
转载自blog.csdn.net/lianxin19900610/article/details/80997214
今日推荐
周排行