title: Order of execution of directive functions in AngularJS
body: <p>What is the order of execution of directive functions? The <a href="http://docs.angularjs.org/guide/directive" rel="noreferrer">documentation</a> doesn't seem to address this.</p>
  <p>Ex</p>
  <ol>
  <li>template / templateUrl (is evaluated)</li>
  <li>controllerFn</li>
  <li>compileFn</li>
  <li>linkFn</li>
  </ol>
  <h1>Answer</h1>
  <p>From <a href="https://stackoverflow.com/questions/16071676#21410877/80714">answer</a> below: <a href="http://plnkr.co/edit/79iyKSbfxgkzk2Pivuak" rel="noreferrer">http://plnkr.co/edit/79iyKSbfxgkzk2Pivuak</a> (plunker shows nested and sibling directives)</p>
  <ol>
  <li>Template is parsed</li>
  <li><code>compile()</code> (changes made to the template within compile are proliferated down to linking functions)</li>
  <li><code>controller()</code></li>
  <li><code>preLink()</code></li>
  <li><code>postLink()</code></li>
  </ol>