Directives encapsulate coded behaviors that can be applied as attributes to HTML elements or other components:
Name | Syntax | Purpose |
Structural Directives |
*ngIf *ngFor *ngSwitch |
Controls structural layout of the HTML and if elements get added or removed from the DOM |
Attribute Directives |
[class] [style] [(model)] |
Listens to and modifies the behavior of other HTML elements, attributes, properties, and components, such as CSS classes, HTML styles, and HTML form elements |
Structural Directives Source: https://angular.io/guide/structural-directives
Attribute Directives Source: https://angular.io/guide/template-syntax#built-in-attribute-directives