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.

2,326 total views, 2 views today

About Mirthbees 678 Articles
Blogger, Innovator, Developer and Enterpreneur. Founder of GuruRecharge, Readymade online recharge script. Lead Developer in Bookrate.in

Be the first to comment

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.