Difference between Structural and Attribute directives in angular?

Difference between Structural and Attribute directives in angular?

What is the difference between Structural and Attribute directives ?

Directives are divided into two types namely Structural and Attribute directives.

These are the differences:

Structural directives:

  • It changes the structure of the DOM.
  • * is prefixed to the structural directives.
  • *ngIf, *ngFor are the examples of structural directives.

 

Attribute directives:

  • It just changes the appearance of the DOM.
  • It is not prefixed with *.
  • ngClass, ngStyle are the examples of attribute directives.

958 total views, 2 views today

Leave a Reply

Your email address will not be published. Required fields are marked *