javascript - Order of execution of directive functions in AngularJS -
what order of execution of directive functions? documentation doesn't seem address this.
ex
- template / templateurl (is evaluated)
- controllerfn
- compilefn
- linkfn
answer
from answer below: http://plnkr.co/edit/79iyksbfxgkzk2pivuak (plunker shows nested , sibling directives)
- template parsed
compile()
(changes made template within compile proliferated down linking functions)controller()
prelink()
postlink()
pre-linking function: executed before child elements linked. not safe dom transformation since compiler linking function fail locate correct elements linking.
post-linking function: executed after child elements linked. safe dom transformation in post-linking function.
above excerpt taken official docs on directives.
so, answer question, post-linking/link function when/where can safely operate on element.children().
Comments
Post a Comment