Structural Directives
Last updated
Last updated
Change the DOM layout by adding or removing DOM elements.
Directives | Details |
---|---|
repeating a component view
When NgIf
is false
, 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
Directives | Details |
---|---|
ngFor
Repeat a node for each item in a list.
ngIf
Conditionally creates or disposes of subviews from the template.
ngSwitch
A set of directives that switch among alternative views.
ngSwitch
An attribute directive that changes the behavior of its companion directives.
ngSwitchCase
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.
ngSwitchDefault
Structural directive that adds its element to the DOM when there is no selected ngSwitchCase
.