Directives
Directives have been part of Angular since its inception. Angular 1 (AngularJS) had loads of directives, but in Angular 2/4 only a select few remain. Directives are custom HTML tags that allow us to extend our HTML. Angular directives allow us to create small HTML components, which can be infused together to create an entire web page. This approach allows us to create multiple reusable templates, which can be shared in an application. You can think of directives as custom controls, which can be used as plug-and-play templates.
We have been using Angular directives in our current application. Let's look at our implementation and understand how directives work.
When a component has a selector defined in its component metadata, as ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access