【问题标题】:How to add custom values in ion-checkbox?如何在 ion-checkbox 中添加自定义值?
【发布时间】:2021-10-21 23:08:36
【问题描述】:

我想知道为 ion-checkbox 设置自定义值的最佳方法。enter image description here

我已经尝试过了,但它不起作用。

【问题讨论】:

标签: angular ionic-framework checkbox ngmodel


【解决方案1】:

试试这样的:

<ion-list>
    <ion-item-group lines="inset" *ngFor="let section of item.value">
      <ion-item-divider class="bg-light">
        <ion-label>{{section.sectionName}}</ion-label>
      </ion-item-divider>
      <ion-item *ngFor="let menu of section.menuItems">
        <ion-label
          ><strong *ngIf="menu.quantity">({{menu.quantity}})</strong>
          {{menu.name}}
          <strong>+ $ {{menu.price | number:'1.2-2'}}</strong></ion-label
        >
        <ion-checkbox
          slot="end"
          (ionChange)="checkBoxChange($event, menu.menuItemId, menu.name)"
          [(ngModel)]="menu.checked"
        ></ion-checkbox>
      </ion-item>
    </ion-item-group>
  </ion-list>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-27
    • 2017-11-19
    • 2018-10-28
    • 2018-04-20
    • 2021-08-06
    • 1970-01-01
    相关资源
    最近更新 更多