What is the difference between a structural and an attribute directive?
- A Structural directives change the DOM layout; attribute directives change appearance or behaviour
- B Attribute directives add elements
- C They are the same
- D Structural directives only work on inputs
Answer
Structural directives change the DOM layout; attribute directives change appearance or behaviour
Structural directives such as ngIf and ngFor use the asterisk prefix and add or remove elements. ngClass and ngStyle are attribute directives.





