I'm trying to create nested reactive forms here : https://stackblitz.com/edit/angular-mgrfbj
This is the project heirarchy:
---create company form (hello.component.ts)
--- company details form (company-details.component.ts)
--- [
employee details form (employee-details.component.ts)
employee details form
employee details form ...
]
For such nested forms, I have to use ViewProviders and FormGroupDirective as given in this video:
The first nested form (company-details.component.ts) is working as expected
But the second form which is added with *ngFor inside a FormArray is not binding to the FormGroupDirective correctly.
When you type the company details and press Print Json, then the printed json will be correct. But when you add an employee or two, then the employee details are not printed in the json.
I know there are other manual ways to accomplish the same thing, but I'm looking for a clean solution that just works without any extra functions.
Any help will be really appreciated!
Thanks in advance
this.fgdis undefined in your employee-details ?