I am trying to create a method to delete rows from my dynamic form and I am having trouble targeting the array.
so the form group is this:
this.piForm = this.fb.group({
milestoneSaveModel: this.fb.group({
milestonesToCreate: this.fb.array([this.mileStoneCreate()]),
}),
});
and then my delete method is this so far:
deleteRow(index: number) {
const control = <FormArray>this.piForm.controls['milestoneSaveModel'].controls['milestonesToCreate'];
control.removeAt(index);
}
my linter tells me Property 'controls' does not exist on type 'AbstractControl'.
however when I trigger this in the browser it actually works. So how do i fix the linting error?
this.piForm.get('milestoneSaveModel').get('milestonesToCreate')and tell me how it goes.