Directives
A directive changes an existing element. Attribute directive: highlight Fail rows. Structural: *ngIf / *ngFor add or remove nodes. Components are directives with a template.
Write @Directive({ selector: '[appFail]' }) and HostBinding('class.fail'). Use it as <tr appFail>. Don’t build a whole component just to add a class.
Trap — putting business rules inside a directive that should live in a service. Directives are for the DOM.
Exam tip
Attribute vs structural. One HostBinding example.