O'Reilly logo

Mastering AngularJS for .NET Developers by Mohammad Wadood Majid, Golrokh Mirzaei

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

Understanding directives

Basically, a directive is a function that is executed once the AngularJS compiler finds it within the DOM. These functions will do nearly anything and that is why it is hard to define what a directive is. Every directive contains a name (such as ng-repeat, tabs, your-own-directive) and every directive determines where it is used, such as in DOM elements, or an attribute, or a class. For example, <copyright> </copyright> where copyright is an AngularJS directive.

AngularJS directives usually contain a post-link function that links directives to the element's children. A sophisticated directive may have a compile function, prelink function, and post-link function. Directives are used anywhere that you deploy the DOM and catch ...

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