javascript - Order of execution of directive functions in AngularJS -


what order of execution of directive functions? documentation doesn't seem address this.

ex

  1. template / templateurl (is evaluated)
  2. controllerfn
  3. compilefn
  4. linkfn

answer

from answer below: http://plnkr.co/edit/79iyksbfxgkzk2pivuak (plunker shows nested , sibling directives)

  1. template parsed
  2. compile() (changes made template within compile proliferated down linking functions)
  3. controller()
  4. prelink()
  5. 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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -