For calling a function when ng-repeat has finished you can use the below mentioned code:-
var module = angular.module('testApp', [])
.directive('onFinishRender', function ($timeout) {
return {
restrict: 'A',
link: function (scope, element, attr) {
if (scope.$last === true) {
$timeout(function () {
scope.$emit(attr.onFinishRender);
});
}
}
}
});
The controller code is:-
$scope.$on('ngRepeatFinished', function(ngRepeatFinishedEvent) {
//you also get the actual event object
//do stuff, execute functions -- whatever...
});
With HTML that looks something like this:
<div ng-repeat="item in items"on-finish-render="ngRepeatFinished">
<div>{{item.name}}}<div>
</div>