Structural Directives
Change the DOM layout by adding or removing DOM elements.
Built-in Structural Directives
Directives | Details |
---|---|
| Repeat a node for each item in a list. |
| Conditionally creates or disposes of subviews from the template. |
| A set of directives that switch among alternative views. |
ngFor
repeating a component view
ngIf
When
NgIf
isfalse
, Angular removes an element and its descendants from the DOM. Angular then disposes of their components, which frees up memory and resources.
guarding against
null
ngSwitch
Directives | Details |
---|---|
| An attribute directive that changes the behavior of its companion directives. |
| Structural directive that adds its element to the DOM when its bound value equals the switch value and removes its bound value when it doesn't equal the switch value. |
| Structural directive that adds its element to the DOM when there is no selected |
Last updated