Skip to content

Instantly share code, notes, and snippets.

@vol4ok
Last active August 29, 2015 13:57
Show Gist options
  • Save vol4ok/9364446 to your computer and use it in GitHub Desktop.
Save vol4ok/9364446 to your computer and use it in GitHub Desktop.
on ng-repeat finish directive for angular js
angular.module("app").directive("onRepeatFinish", ["$timeout", function($timeout){
return {
restrict: "A",
link: function($scope, $element, $attrs) {
if ($scope.$last) {
$timeout(function(){
if (angular.isFunction($scope[$attrs["onRepeatFinish"]]))
$scope[$attrs["onRepeatFinish"]]()
});
}
}
}
}]);
@vol4ok
Copy link
Author

vol4ok commented Mar 5, 2014

Usage

  <div ng-repeat="item in items" on-repeat-finish="my-finish-routine">...</div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment