I am stuck on what i need to use as the formControlName for my arrays in my reactive form, I want the array to be [1,2,3] but i want to to be able to add and delete from the array but also have multiple arrays, I can get it to work if I create new arrays and set the arrays from outside the form but i dont feel it will be very scale able if i make a large form, thanks for the help
Ive tired making the formControlName="{{j}}" and i still get an empty value when i console log the array
this.multiplerForm = this.fb.group({
multipliers: this.fb.array([
this.fb.group({
reps: this.fb.array([]),
})
])
});
addReps(control){
control.push((this.fb.control('')));
}
removeReps(control,index: number) {
control.removeAt(index);
}
<StackLayout formArrayName="reps">
<GridLayout rows="*" columns="*,*,*" *ngFor="let rep of multiplier.get('reps').controls; let j=index" [formGroupName]="j" >
<Label col="0" text="Set {{j+1}}" ></Label>
<TextField col="1" formControlName="{{j}}" ></TextField>
<Button col="2" text="X" (tap)="removeReps(multiplier.controls.reps,j)"></Button>
</GridLayout>
</StackLayout>