Directives are everywhere. They are the fundamental building blocks of Angular. Each extension to the application has resulted in us creating new component directives. These component directives have further consumed attribute directives (such as NgClass
and NgStyle
) and structural directives (such as NgIf
and NgFor
) to extend their behavior.
While we have built a number of component directives and a lone attribute directive, there are still some concepts of directive building that are worth exploring. This is especially true for attribute and structural directives, which we are yet to cover in detail.
The topics we will cover in this chapter include the following:
- Building directives: We build multiple directives and learn where directives are useful, how they differ from components, and how directives communicate with each other and/or their host component. We explore all directive types, including component directives, attribute directives, and structural...