When an Angular directive contains an ngRepeat element, the ngRepeat execution appears to to occur after the containing directive's link execution.
Is there a mechanism ($watch, $observe, etc) that I can use to wire up a response after the ngRepeat execution?
Here's an example of the behavior: http://plnkr.co/edit/yBiSvveeSissU7Rik6Kp?p=preview
I want to operate in a state in the directive where the inputs are available.
My primary goal is to alter the elements of ngRepeat from the containing directive.
Directives are compiled in priority order, from highest to lowest. The default is 0. If set to true then the current priority will be the last set of directives which will execute (any directives at the current priority will still execute as the order of execution on same priority is undefined).
Definition and Usage. The ng-repeat directive repeats a set of HTML, a given number of times. The set of HTML will be repeated once per item in a collection. The collection must be an array or an object. Note: Each instance of the repetition is given its own scope, which consist of the current item.
terminal: Used with priority. If set to true, it stops execution of directives with lower priority.
Angular-JS ng-repeat directive is a handy tool to repeat a set of HTML code for a number of times or once per item in a collection of items. ng-repeat is mostly used on arrays and objects.
The typical way to determine when ng-repeat has finished is to write a directive that checks to see if $last
is true. Then you can call a function (defined on a parent/ancestor scope) or emit an event, inside a $timeout
callback or $evalAsync
.
For more details and examples, see Calling a function when ng-repeat has finished
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