Ionic 如何在单击按钮时提交离子单选按钮值?

mfuanj7w  于 2022-12-09  发布在  Ionic
关注(0)|答案(1)|浏览(183)

需要在单击“提交”按钮时传递选定单选按钮的值

<!--Starts Location Select Popover -->
<ion-list>
  <ion-list-header>
    <h5> Select Location</h5>
  </ion-list-header>
  <ion-item *ngFor="let store of storeLocations">
    <ion-label>{{store?.storeName}}</ion-label>
    <input type="radio" slot="end" value="{{store}}" />
  </ion-item>
  <ion-button expand="block" (click)="dismissLocationSelectPopover(store)">Submit Location
  </ion-button>
</ion-list>
<!--Ends Location Select Popover -->
jw5wzhpr

jw5wzhpr1#

不支持[(ngModel)]。最好改用(click)

HTML格式

<input type="radio" slot="end" value="{{storeLoc.storeName}}" id="{{storeLoc.storeName}}"(click)="storeSelected(storeLoc)" />

技术支持

storeSelected(storeLoc) {
    this.storeSelected = storeLoc;
  }

相关问题