O'Reilly logo

AngularJS Directives by Alex Vanston

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

What about linking?

Ok, so now that we've taken a look at some of the uses for compile, you may be wondering when you would ever want to use link. The answer: pretty much always. First of all, realize that both of the examples we reviewed in the preceding section use the linking function; they just initialize it differently, then return it from the compile function instead of attaching it directly to the link property. Secondly, while the ability to have low level access to the element template and fine-tune exactly when and where the linker function comes into play sounds awesome (and it is), in reality there are actually very few times you'll need that much control. Out of the 26 different directives included with the awesome AngularUI library, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required