Building custom directives
Custom directives encompass a vast world of possibilities and use cases, and we would need an entire book to showcase all the intricacies and possibilities they offer. In a nutshell, they allow you to attach advanced behaviors to elements in the DOM or modify their appearance.
If a directive has a template attached, then it becomes a component. In other words, components are Angular directives with a view. This rule becomes handy when we want to decide whether we should create a component or a directive for our needs. If we need a template, we create a component; otherwise, make it a directive.
As we have already learned, directives fall mainly into two categories: structural and attribute. In the following sections, we will showcase how to create a directive for each category from scratch.
Displaying dynamic data
We have all found ourselves in a situation where we want to add copyright information to our applications. Ideally, we want to use...