在我的Ionic应用程序中,我有一个离子选择:
<ion-item> <ion-label>Type</ion-label> <ion-select [(ngModel)]="type" interface="action-sheet"> <ion-option *ngFor="let type of types" value="type.class"> {{type.name}} </ion-option> </ion-select> </ion-item>
每当我选择一个选项时,它会选择所有可用的选项.
我alredy尝试使用属性multiple =“false”但没有奏效.
额外细节:
type.class is the same value for every option. I already put diferent values for each option. None worked.
If I totally remove the value=”” it work properly
有帮助吗?
解决方法
由于您的值赋值是动态的,您需要在值周围使用[],
<ion-option *ngFor="let type of types" [value]="type.class"> {{type.name}} </ion-option>
希望能帮助到你.