Last active
December 31, 2015 20:59
-
-
Save ferrislucas/8044120 to your computer and use it in GitHub Desktop.
angular directive to emit after an ng-repeat finishes rendering
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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