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