What are Directives in Angular 2 ?
A Directive is the building block of any Angular Application. Directive modifies the DOM elements to change in appearance, and behavior or layout of DOM elements. Directives mainly perform two actions, It change the DOM layout by adding and removing DOM elements. And can change the appearance or behavior of an DOM element.
Types of Directives:
There are three kinds of directives in Angular:
- Attribute directives—It change the appearance or behavior of an element, component, or another directive.
- Structural directives—It change the DOM layout by adding and removing DOM elements.
- Components—Directives with a template.
Now Lets understand each of them with their examples in our next tutorials.