ionic 4 - how to create repeated form fields

旧时模样 提交于 2020-05-24 04:55:28

问题


I need to create a form to update multiple data items at the same time.

It means repeating the same fields in a single form.

My data is basically:

this.formData = [
  {areaId:1, price:10, qty:1000},
  {areaId:2, price:10, qty:1000},
  {areaId:3, price:10, qty:1000},
  ...
]

So I'm looping this data but I don't know how should I name those fields, cause they're repeating.

<ng-container *ngFor="let a of this.formData; let i = index">
  <div class="area" [attr.areaId]="a.id">
    <ion-range min="1" max="10" step="1" name="price" value="XXXXX"></ion-range>
    <ion-range min="1" max="10" step="1" name="qty" value="XXXXX"></ion-range>
  </div>
</ng-container>

<ion-button (click)="submitForm()">submit</ion-button>

Any thoughts?

来源:https://stackoverflow.com/questions/61173600/ionic-4-how-to-create-repeated-form-fields

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!