Angular 2 – Directives

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:

  1. Attribute directives—It change the appearance or behavior of an element, component, or another directive.
  2. Structural directives—It change the DOM layout by adding and removing DOM elements.
  3. Components—Directives with a template.

Now Lets understand each of them with their examples in our next tutorials.