interview community logo

0
0
What are the types of directives
1 answer

what are the types of directives?

and what are the built-in example for each of them?

Angular Robert Isaac asked 1 year ago


0

there are 3 types of directives:

  1. component (example router-outlet) is the main building block for Angular applications, they can be used in a reusable form with a selector and inputs, or being bind to a route with params
  2. structural directive (example ngIf) is used to to control if an element should be added or remove from the DOM
  3. attribute directive (example ngClass) is used to change specific behavior of the element applied to (with ngClass for example to add or remove a class for the Element)
Robert Isaac answered 1 year ago loading comments...