Understanding Directives

Directives are a combination of AngularJS template markups and supporting JavaScript code. AngularJS directive markups can be HTML attributes, element names, or CSS classes. The JavaScript directive code defines the template data and behavior of the HTML elements.

The AngularJS compiler traverses the template DOM and compiles all directives. Then it links the directives by combining a directive with a scope to produce a new live view. The live view contains the DOM elements and functionality defined in the directive.

Get Learning AngularJS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.