Thursday, August 7, 2014

Angular.js: Directive execution order

Last week, a colleague asked me if there is a way to control the order in which your Angular.js Directives get executed.

Of course you can! Every directive has a ‘priority’ property. When there are multiple directives defined on a single DOM, the priority is used to sort the directives before their compile functions get called. Directives with greater numerical priority are compiled first. The default priority is 0.

An example:


M3rken said...

Thanks, Bart.

Hadn't found that solution in the documentation.

Just for reference, here are some additional options for configuring directives :$compile

optisol biz said...

Great post. I’ve learned a lot of info from your blog so far. kindly update the latest technology or frameworks. Thanks..

Ruby on Rails Developers

The Angular.JS said...


Great. I has the doubt on how it works exactly. Now my double is cleared on the directive execution order.


Angularjs Training in Chennai