【问题标题】:When i select value from dropdown which is hardcoded it doesn't pick value and doesn't send it in database当我从硬编码的下拉列表中选择值时,它不会选择值并且不会将其发送到数据库中
【发布时间】:2020-04-16 13:41:27
【问题描述】:

我的页面.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

当我在关闭下拉菜单后选择“休闲”时,它会显示“医疗”而不是“休闲”,并且不会将值保存在数据库中。

【问题讨论】:

    标签: php html css angular ionic4


    【解决方案1】:

    将此行改为

    <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>
    

    【讨论】:

    • 但它不与 ngmodel 绑定
    猜你喜欢
    • 1970-01-01
    • 2021-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-30
    相关资源
    最近更新 更多