There are tons of posts showing how to have callback functions based on a directive so that when an ng-repeat function is finished you can wait and then call a function. For example here is my example.
<div ng-repeat="Object in Objects" class="objectClass" on-finish-render>{{Object.Overlay}</div>
Then when it is completed the following calls my function
.directive('onFinishRender', function ($timeout) {
return {
restrict: 'A',
link: function (scope, element, attr) {
if (scope.$last === true) {
$timeout(function () {
scope.$emit('ngRepeatFinished');
}, 0);
}
}
}
});
This successfully calls my function below when it is completed
$scope.$on('ngRepeatFinished', function(ngRepeatFinishedEvent) {
//my code goes here
}
Now all of that works perfectly and as intended the first time I set my $scope.Objects variable. My code will wait until all objects are fully rendered and then runs, literally perfect. However if after the initial everything I change $scope.Objects again, my function will still run but it will NOT wait for the completion. Its actually visible with console logs, the first go round it will pause for about half a second after I go into the directive but before the actual emit, but on subsequent changes to my ng-repeat it does not pause and simply calls my function before the dom is finished rendering.
This is super annoying and any help would be great!