mercredi 21 mars 2018

Angular 2 dynamic dropdown using ngfor

I have response like this

Array(3)
        0:
        val_id:1
        role_id:1
        id:1
        is_optional:false
        is_text:false


        1:
        val_id:1
        role_id:1
        id: 2
        is_optional:false
        is_text:false


        2:
        val_id:1
        role_id:1
        id :3
        is_optional: false
        is_text: false

html

  <div *ngFor="let question of response" class="row">
        <select id="" class="dropdown" [(ngModel)]="questions"  (change)= "GetDataselected($event.target.value)">
                          <option *ngFor = "let option of responseoption"> </option>
                          </select>  
    </div>

from above code, i am doing ngFor with response and creating a three dropdowns(resposne), if i select any one dropdown option, all other dropdown are also selecting with same value.how to rid of this.

Please help me.




Aucun commentaire:

Enregistrer un commentaire