OpenSource For You

Building your own directives

-

AngularJS allows you to build your own custom directives, which are nothing but an extension to the HTML. They are defined using the ‘directive’ function, and simply replace the element for which they are activated. AngularJS finds the matching elements and processes them once, using its compile() method; it then processes the elements using the link() method of the custom directive based on the scope. It supports the creation of custom directives for the following types of elements. Element directives: It activates once a matching element is encountere­d. Attribute: It activates once a matching attribute is encountere­d. CSS: It activates once a matching CSS style is encountere­d. Comment: It activates once a matching comment is encountere­d.

Newspapers in English

Newspapers from India