当所有控制器都在 Angularjs 中的 ng-repeat 中初始化时,如何在加载所有内容后捕获事件?

How to catch an event after all content is loaded when all controllers are initialized inside an ng-repeat in Angularjs?

<!-- Begin page content part of a pageCtrl -->
<div class="container" ng-init="pageInit();">
   <div class="template {{block.type}}" ng-repeat="block in pageBlocks" my-repeat-directive>
     <div ng-controller="templateCtrl" ng-include src="'partials/components/' + block.type + '.html'" ng-init="initTemplate(block);"></div>
   </div>
</div>

在我的 ng-repeat 中,我使用 templateCtrl 动态初始化一些小模板,从我的 pageCtrl 范围传递一些数据。 我的目标是在 Angularjs.

加载和编译我的模板的所有内容后能够执行一些 javascript

但目前我找不到 "after all is compiled" 事件来管理一些简单的回调操作。

我在 ng-repeat 上尝试了指令和 on-last-repeat 操作,我尝试了 scope.$watch、$timeout、$scope.$on('$viewContentLoaded')... 但任何工作行为。

有什么想法、建议吗?提前致谢

经过一些其他的尝试,我最终得到了这个解决方案,它似乎工作得很好。

这个在html

<div ng-controller="templateCtrl" ng-include src="'partials/components/' + block.type + '.html'" ng-init="initTemplate(block);" template-directive></div>

这在 javascript

app.directive('templateDirective', function($timeout){
  return {
    restrict: "EA",
    compile: function(element, attributes){
      return {
        post: function(scope, element, attributes, controller, transcludeFn){

          if(scope.$last){
            $timeout(function(){
              //operations in the callback
            }, 250);
          }
        }
      };
    }
  };
});

专家们同意吗?