If you evaluate 'd' || 'e' || 'f'
the result is 'd'
and when options
is not 'd'
, then it doesn't match. You can't use ngSwitchCase
that way.
This would work:
<ng-container [ngSwitch]="true">
<ng-container *ngSwitchCase="options === 'a'">Code A</ng-container>
<ng-container *ngSwitchCase="options === 'b'">Code B</ng-container>
<ng-container *ngSwitchCase="options === 'c'">Code C</ng-container>
<ng-container *ngSwitchCase="options === 'd' || options === 'e' || options === 'f'">Common Code</ng-container>
<ng-container *ngSwitchDefault>Code Default</ng-container>
</ng-container>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…