加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angular – On IONIC Ion-Select正在“选择”所有选项

发布时间:2020-12-17 17:03:51 所属栏目:安全 来源:网络整理
导读:在我的Ionic应用程序中,我有一个离子选择: ion-item ion-labelType/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 每当我
在我的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>

希望能帮助到你.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读