I have a component that takes several FormControl
s and FormArray
s as inputs. I'm accessing the FormControl
s from the child component like this:
[formControl]="control"
This works fine, but I can't find a way to do the same with a FormArray
. There doesn't appear to be a directive for it. I would like to avoid passing in a bunch of strings and accessing via formControlName
and formArrayName
if possible. Is there a way to do this?
Update there was a type error, jsut corrected
You can use a FormArray like a FormGroup, but be carefully with the "notation", if normally we use [formGroup]="i", now we use [formGroup]="group".
It's only think about what is myFormArray.controls
If your formArray is a FormArray of controls use directly formControl
See in stackblitz