Logo

dev-resources.site

for different kinds of informations.

Angular @switch

Published at
11/8/2023
Categories
angular
angular17
typescript
ngswitch
Author
dionisd
Author
7 person written this
dionisd
open
Angular @switch

Angular has released the new '@switch' block syntax similar to Javascript

How does this work?
Angular ngSwitch Alternative

  • The @switch blocks displays content selected by one of the cases matching against the conditional expression

  • The @default block is optional and can be omitted. If no @case matches the expression and there is no @default block, nothing is shown

  • @switch does not have fallthrough, so you do not need an equivalent to a break or return statement.

Angular docs

Featured ones: