October 2017
Intermediate to advanced
640 pages
18h 17m
English
As with many other features of Angular, you can extend functionality by creating your own custom directives. Custom directives allow you to extend the functionality of HTML by implementing the behavior of elements yourself. If you have code that needs to manipulate the DOM, it should be done inside a custom directive.
You implement a custom directive by calling the @directive class, much the same way you define a component. The @directive class metadata should include the selector of the directive to be used in the HTML. The Directive export class is where the logic for the directive will reside. For example, the following is a basic definition for a directive:
import { Directive } from '@angular/core'; @Directive({ selector: ...Read now
Unlock full access