June 2014
Intermediate to advanced
696 pages
38h 52m
English
When the AngularJS HTML compiler encounters a directive, it runs the directive’s compile function, which returns the link() function. The link() function is added to the list of AngularJS directives. Once all directives have been compiled, the HTML compiler calls the link() functions in order, based on priority.
If you want to modify the DOM inside a custom directive, you should use a link() function. The link() function accepts the scope, element, and attributes associated with the directive, allowing you to manipulate the DOM directly within the directive.
Inside the link() function, you handle the $destroy event on the directive element and clean up anything necessary. The link() function is also responsible ...
Read now
Unlock full access