Skip to content

Instantly share code, notes, and snippets.

@ferrislucas
Last active December 31, 2015 20:59
Show Gist options
  • Save ferrislucas/8044120 to your computer and use it in GitHub Desktop.
Save ferrislucas/8044120 to your computer and use it in GitHub Desktop.
angular directive to emit after an ng-repeat finishes rendering
/* usage:
<p on-finish-repeat="this is emitted when the ng-repeat finishes" ng-repeat="item in items"></p>
*/
app.directive('onFinishRepeat', function ($timeout) {
return {
restrict: 'A',
link: function (scope, element, attr) {
if (scope.$last === true) {
$timeout(function() {
scope.$emit(attr.onFinishRepeat);
});
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment