Taking control of the compilation process

There are some situations where we need to have more control over how AngularJS compiles and links an element and its children. Perhaps we wish to load the directive's template dynamically or we want more control over the transclusion of elements into a directive's template. In these cases we can terminate the compilation process then modify and compile the directive's element and children manually.

Creating a field directive

When writing applications that use forms, it quickly becomes apparent that there is a lot of duplication and redundancy in the amount of boilerplate HTML requires for each field on the form.

For instance, and for every field there will be an input element and a label element surrounded ...

Get Mastering Web Application Development with AngularJS now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.