Created
March 30, 2015 17:19
-
-
Save aradnom/6f7eb466bc40a6fcf21f to your computer and use it in GitHub Desktop.
Simple directive for firing an event when ng-repeat is finished populating.
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
'use strict'; | |
/** | |
* Simple directive for emitting an event when repeat is finished | |
*/ | |
App.directive( 'repeatDoneEvent', function ( $window ) { | |
return function( scope, element, attrs ) { | |
if ( scope.$last ) { | |
// At this point, ng-repeat is done populating - but we're not finished | |
// yet because $compile still has to compile any tags in the repeat | |
// directive | |
scope.$evalAsync(function() { | |
// NOW we're done | |
scope.$emit( 'ngRepeatFinished', element ); | |
}); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment