top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is use for ngSwitchCase in Angular(2/4/5)?

0 votes
457 views
What is use for ngSwitchCase in Angular(2/4/5)?
posted Jan 26, 2018 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

ngSwitchCase - Adds/removes DOM sub-trees when the nest match expressions match the switch expression.

Example

<container-element [ngSwitch]="switch_expression">
  <some-element *ngSwitchCase="match_expression_1">...</some-element>
  <some-element *ngSwitchCase="match_expression_2">...</some-element>
  <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
  <ng-container *ngSwitchCase="match_expression_3">
    <!-- use a ng-container to group multiple root nodes -->
    <inner-element></inner-element>
    <inner-other-element></inner-other-element>
  </ng-container>
  <some-element *ngSwitchDefault>...</some-element>
</container-element>

Read More Here : https://angular.io/api/common/NgSwitch

answer Jun 11, 2018 by Aarati Mahajan
...