Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Angular 17 switch case Example | *ngSwitch Case

TThe improved ergonomics is even more visible with *ngSwitch:

The new control flow enables significantly better type-narrowing in the individual branches in @switch, which is impossible in *ngSwitch.

Before Angular 17,

 

 

 


Which with the built-in control flow turns into:

From Angular 17,

@switch (accessLevel) {

  @case ('admin') { }

  @case ('moderator') { }

  @default { }

}



This post first appeared on Programming, please read the originial post: here

Share the post

Angular 17 switch case Example | *ngSwitch Case

×

Subscribe to Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×