如果我ng-repeat
项目中放置更多带有表格的文本,即使在呈现最后一个ng-repeat
项目后,页面也会显示加载状态。当然,我无法向下滚动或看到悬停按钮,或者在页面停止时无法执行任何操作。我在项目本地的复杂代码中遇到了这个问题。
直到真正完成加载页面,而不是在 ng-repeat 中的最后一项之后。
在此处查看 plnkr。
将$timeout添加到指令和范围中$last事件:
app.directive('myRepeatTrigger',['$timeout', function($timeout) {
return function(scope, element, attrs) {
$timeout(function () {
if (scope.$last){
alert('stop loading page');
}
});
};
}]);