I'm currently working on a method to delete rows from a dynamic form, but I am struggling to target the array.
The structure of my form group is as follows:
this.piForm = this.fb.group({
milestoneSaveModel: this.fb.group({
milestonesToCreate: this.fb.array([this.mileStoneCreate()]),
}),
});
Here's what my delete method looks like so far:
deleteRow(index: number) {
const control = <FormArray>this.piForm.controls['milestoneSaveModel'].controls['milestonesToCreate'];
control.removeAt(index);
}
Even though the browser successfully triggers the action, my linter shows an error message saying
Property 'controls' does not exist on type 'AbstractControl'.
How can I address this linting error while keeping the functionality intact?