Chapter 10AngularJS Directives
The Directive API is one of the coolest features of AngularJS. Now
that you've been developing in AngularJS for some time, you've come across
many simple directives, such as ng-repeat
,
ng-show
, ng-model
, etc. But when you
come to develop real world apps you'll most likely need custom directives.
This chapter will teach you how to build these and implement them in our
demo app.
What Are Directives, Really?
A directive is something that attaches special behavior to a DOM
element and teaches it awesome tricks! Let's take the example of the
built-in ng-repeat
directive: What this does is attach
special behavior to a DOM element by repeating it multiple times.
Similarly, ng-show
and ng-hide
conditionally show or hide ...
Get AngularJS: Novice to Ninja 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.