I have a custom filter function I'm calling for ng-repeat directive:
<div ng-repeat="app in appVm.appList | filter:appVm.assetFilter">{{app.title}}</div>
This obviously hits my assetFilter function for each app in the appList. When filtering is complete, I want to run another function.
How can I detect when the filtering pass has completed?
Update
Based on responses pointing me towards other answers, I can clarify a bit further.
When I implement that solution with a custom directive and using the scope.$last, I observe the following:
Hope this helps to clarify.
ng-repeat creates a scope for each repeated element. This scope includes $first and $last so you can add a directive that checks for these
HTML
<div ng-repeat="item in items" check-last>
Directive:
app.directive('checkLast',function(){
return{
restrict:'A',
link:function(scope,elem,attrs){
if(scope.$last){
/* repeater done code*/
}
}
}
})
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With