Skip to content

@switch

@switch replaces [ngSwitch] with a cleaner, more readable syntax.

@switch (status) {
@case ('loading') { <app-spinner /> }
@case ('success') { <app-success /> }
@case ('error') { <app-error /> }
@default { <p>Unknown status</p> }
}

@switch provides a more readable alternative to ngSwitch.”