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
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
myFormArray=new FormArray([
new FormGroup({
prop1:new FormControl('',Validators.required),
prop2:new FormControl('',Validators.required)
})
])
If your formArray is a FormArray of controls use directly formControl
myFormArray2=new FormArray([
new FormControl('',Validators.required),
new FormControl('',Validators.required)
])
See in stackblitz