1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Two switch case values in angular

Discussão em 'Angular' iniciado por Niyaz, Outubro 5, 2024 às 23:22.

  1. Niyaz

    Niyaz Guest

    In php and java we can do

    case 1:
    case 2:
    echo "something";


    so that when the value is 1 or 2 "something" will be printed on the screen, i am building an angular application i am doing something like the below

    <div [ngSwitch]="data.type">
    <div *ngSwitchCase="'multi-choice'">FORM 1</div>
    <div *ngSwitchCase="'singe-choice'">FORM 1</div>
    <div *ngSwitchCase="'range'">FORM 2</div>
    </div>


    The form which is used for single choice can be used for mutiple choice , but i tried something like below to make it more organisable

    <div [ngSwitch]="data.type">
    <div *ngSwitchCase="'multi-choice' || 'singe-choice'">FORM 1</div>
    </div>


    My bad luck it didnt work, can anyone suggest the better way to do this.

    Continue reading...

Compartilhe esta Página