when pass a FormControl/or FormArray to a component, the component can implements ControlValueAssesor -the is like another input-, or we can pass the FormControl/FormArray itseft -nor formArray name-.
When we use an FormArray is advisable use a getter in .ts
articlesFormArray get()
{
return this.form.get('articles') as FormArray
}
So, you can pass as argument the formArray
<articles-list [myFormArray]="articlesFormArray"></articles-list>
And in articles-list
@Input() myFormArray:FormArray
//create a new getter to get the FormGroup of the formArray,
get formGroup(i)
{
return myFormArray.at(i) as FormGroup
}
<div *ngFor="let control of myFormArray.controls;let i=index">
<div [formGroup]="formGroup(i)">
<input formControlName="articleId">
</div>
</div>
Is our children mannage a FormGroup, you can pass the formGroup, imagine in the example before a children-component
@Input('group') form:FormGroup //<--the name is group, but the variable "form"
//it's only show a characteristic of Inputs
<div [formGroup]="form">
<input formControlName="articleId">
</div>
We can replace use in articles-list.html
<div *ngFor="let control of myFormArray.controls;let i=index">
<children-component [group]="formGroup(i)">
</div>