I\'m fairly new to Javascript programming and I have only touched upon AngularJS. In order to evaluate it I decided to write a simple note application. The model is really s
Quoting Josh D. Miller who had kindly responded to a similar question I had :
" Just a couple of technical notes. Assume that you have this markup:
<div directive1>
<div directive2>
<!-- ... -->
</div>
</div>
Now AngularJS will create the directives by running directive functions in a certain order:
directive1: compile
directive2: compile
directive1: controller
directive1: pre-link
directive2: controller
directive2: pre-link
directive2: post-link
directive1: post-link
By default a straight "link" function is a post-link, so your outer directive1's link function will not run until after the inner directive2's link function has ran. That's why we say that it's only safe to do DOM manipulation in the post-link. "
On a single element the order of the linking functions is determined by the order of the Compile Functions which in turn is ordered according to the priority
property of the directive definition object.
Source : http://docs.angularjs.org/guide/directive
On multiple elements with transclusion : the inner directives are evaluated before outer directives. Reason: Nature of transclusion.
On multiple elements with siblings : Executed in order top to bottom. Reason: Parsing logic of $compile.