Searching stackoverflow for this question always give me the solution for Angular.js.
How would you do this in Anuglar dart?
That is I want to have a function run after an ng-repeat directive in angular dart has finished rendering its elements.
EDIT:
It turns out that knowing when ng-repeat has finished enumerating doesn't means the appropriate dom element has being attached to the document.
I guess my intended question was how to determine when all elements enumerated by ng-repeat is attached to the dom tree and can be queried by selector
EDIT2
<div ng-repeat='fruit in fruits'>
<li class="fruit">{{fruit}}</li>
</div>
querySelectorAll('.fruit'); // should return all <li> element created by ng-repeat
// the trick is knowing when and where to call querySelectorAll
Thanks
See angular.NgRepeatDirective
However unless your list is fairly large, should not most of the elements be drawn at roughly the same time? Perhaps you could watch the collection for changes.
I tried
{{foo($last)}}
and it didn't work for me either.This example uses
MutationObserver
to get notified about added elements. I tried it and it worked.have a look at this GitHub issue (https://github.com/angular/angular.dart/issues/843) for more information.
It smells like a bug to me, but I'm not sure.
As a workaround you could schedule a future outside of angular. There's more info about this in the above mentioned issue.