Structural Directives
Change the DOM layout by adding or removing DOM elements.
Built-in Structural Directives
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.
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
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
.
Last updated
Was this helpful?