Directive là class gắn behavior vào DOM hoặc template.
Attribute directive thay đổi behavior/appearance của element có sẵn, ví dụ highlight hoặc permission state. Structural directive thay đổi cấu trúc DOM bằng cách thêm/xóa view. Trong Angular hiện đại, legacy ngIf, ngFor, *ngSwitch đã bị deprecate từ v20 để ưu tiên block syntax như @if, @for, @switch.
A directive is a class that attaches behavior to the DOM or a template.
An attribute directive changes behavior or appearance of an existing element, such as highlight or permission state. A structural directive changes DOM structure by adding/removing views. In modern Angular, legacy ngIf, ngFor, and *ngSwitch have been deprecated since v20 in favor of block syntax such as @if, @for, and @switch.