trigger function after ng-repeat

寵の児 提交于 2019-12-02 11:19:44

You have to add a $on catcher in your controller:

$scope.$on('ngRepeatFinished'), function (ngRepeatFinishedEvent) {
      console.log "After loop";
}

A directive in your app.js:

.directive('onFinishRender', function($timeout) {
    return {
      restrict: 'A',
      link: function(scope, element, attr) {
        if (scope.$last) {
          return $timeout (function() {
            scope.$emit 'ngRepeatFinished'
          });
       }
    }
})

and in your view:

on-finish-render="myFunc()"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!