One of the major reasons for AngularJS' popularity is directives and they are everywhere. We have used them throughout the book without putting much thought into how they actually function and how to create one. Directives, together with data-binding infrastructure, make true view-logic separation possible.
Consuming directives is easy, but creating one is a complex task and requires an understanding of the inner workings of the framework and directives itself. This chapter will give an insight into the world of directives and in the process you will build some useful directives for the Personal Trainer app.
The following topics will be covered in this chapter:
Understanding directive basics: We learn about what directives are and build a rudimentary directive.
Understanding the phases of directive execution: We look at the compile and link phases of directive execution and analyze the framework's
ng-click
directive in this context.Implementing inter-directive...