I have a FormGroup that reference some of its field to another component that makes it its child. However, I am getting this error whenever I am on the rendering stage of the child
Error: formControlName must be used with a parent formGroup directive. You'll want to add a formGroup...
This is a generic error when you include a formControlName property on a field outside the FormGroup. I have make sure that the parent rendered first the FormGroup before its child, and by right, that's the default behaviour.
Parent HTML is something like this.
<form [formGroup]="form.formGroup" #formDirective="ngForm" (ngSubmit)="saveForm(formDirective)">
<input matInput formControlName="form.mainInputControl" placeholder="This one doesn't have a problem" type="text">
<child-component [details]="form.detailsForChild"></child-component>
</form>
Child HTML is something like this
<mat-checkbox formControlName="detailsForChild.checkBoxControl"></mat-checkbox>
PS: That's not real variable name, I just do it so it will be intuitive.