Reputation: 12864
I want to call a scope function inside my ng-repeat
just for the last element, like this:
<div ng-repeat="patient in patients" >
<div ng-if="$last" ng-load="myFunction()"></div>
</div>
But ng-load
doesn't work!
Upvotes: 5
Views: 2266
Reputation: 13918
I think this should work:
<div ng-repeat="element in array" ng-init="$last && myFunction(element)">
{{element}}
</div>
There you have working JSFiddle.
Upvotes: 6
Reputation: 8407
Use ng-init="$last && myFunction()", that should do the same thing.
Upvotes: 2