Skip to content

Instantly share code, notes, and snippets.

@searleb
Created May 3, 2016 05:19
Show Gist options
  • Save searleb/902c00885daa93e0d386d49822e071e8 to your computer and use it in GitHub Desktop.
Save searleb/902c00885daa93e0d386d49822e071e8 to your computer and use it in GitHub Desktop.
How to act detect the end of ng-repeat - useful for jQuery
// Init slider with options
scope.$on('LastRepeaterElement', function(){
// Do something
$slider.slick(slickOptions);
});
.directive('emitLastRepeaterElement', function() {
return function(scope) {
if (scope.$last){
scope.$emit('LastRepeaterElement');
}
};
});
<div ng-repeat="foo in bar" emit-last-repeater-element</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment