当我 select 来自硬编码的下拉列表中的值时,它不会选择值并且不会将其发送到数据库中
When i select value from dropdown which is hardcoded it doesn't pick value and doesn't send it in database
我的page.html
<ion-item>
<ion-label color="medium">Leave</ion-label>
<ion-select [(ngModel)]="leavetype" name="leavetype">
<ion-select-option *ngFor="let val of result" value=""> {{val. leavetype}} </ion-select-option>
</ion-select>
</ion-item>
例子:-
我在下拉列表中有如下所示的值:
Medical
Casual
Other
当我 select 'casual' 关闭下拉列表后,它显示 'Medical' 而不是 'Casual' 并且它不会将值保存在数据库中。
将此行更改为
<ion-select-option *ngFor="let val of result" value=""> {{val. leavetype}} </ion-select-option>
到
<ion-select-option *ngFor="let val of result" [value]="val.leavetype"> {{val. leavetype}} </ion-select-option>
</ion-item>
我的page.html
<ion-item>
<ion-label color="medium">Leave</ion-label>
<ion-select [(ngModel)]="leavetype" name="leavetype">
<ion-select-option *ngFor="let val of result" value=""> {{val. leavetype}} </ion-select-option>
</ion-select>
</ion-item>
例子:- 我在下拉列表中有如下所示的值:
Medical
Casual
Other
当我 select 'casual' 关闭下拉列表后,它显示 'Medical' 而不是 'Casual' 并且它不会将值保存在数据库中。
将此行更改为
<ion-select-option *ngFor="let val of result" value=""> {{val. leavetype}} </ion-select-option>
到
<ion-select-option *ngFor="let val of result" [value]="val.leavetype"> {{val. leavetype}} </ion-select-option>
</ion-item>