Can you pass an array of values into an ngSwitch?

Discussão em 'Angular' iniciado por Andrew Fraser, Setembro 25, 2024.

  1. I have a functioning ngSwitch

    <div class="columnFormatting" [ngSwitch]="statusIds">
    <div *ngSwitchCase="2"> Do 2 </div>
    <div *ngSwitchCase="4"> Do 4 </div>
    <div *ngSwitchDefault> Default </div>
    </div>


    StatusIds can contain one or more integers separated by commas.

    If statusIds is [2,4] I want it to hit both cases. Is this possible without a foreach loop outside of the switch?

    Continue reading...

Compartilhe esta Página