当ng-repeat重新渲染时,是否可以触发加载事件。我可以让它在初始加载时工作,但是当加载新范围时,我无法再次触发负载。
现在,我有这个指令:
.directive('onLastRepeat', function() {
return function(scope) {
if (scope.$last){
setTimeout(function(){
scope.$emit('onRepeatLast');
}, 1);
}
};
})
它会在第一次触发但不会在我更改ng-repeat的范围时触发。
控制器
$scope.$on('onRepeatLast', function(scope){
$scope.$apply(function () {
$scope.doneLoading = true;
});
});
HTML
<md-progress-circular class="loading" ng-hide="doneLoading"></md-progress-circular>
<li ng-repeat="task in done" on-last-repeat>
{{task}}
</li>
//I removed extra code to hopefully be more clear, basically I am just querying for a different time range through a service to get the new time range.
var doneRef = new Firebase("https://myfirebase.firebaseio.com.startAt(start).endAt(end);
可以这样做吗?