December 2014
Intermediate to advanced
346 pages
6h 14m
English
One of the most common use cases of directives is to create custom HTML elements that are able to encapsulate their own template and behavior. Directive complexity increases very quickly, so ensuring your understanding of its foundation is essential. This recipe will demonstrate some of the most basic features of directives.
Creating directives in AngularJS is accomplished with a directive definition object. This object, which is returned from the definition function, contains various properties that serve to shape how a directive will act in your application.
You can build a simple custom element directive easily with the following code:
(app.js) // application module definition angular.module('myApp', ...Read now
Unlock full access