I'm trying to create a ReactiveForm
in Angular
with this data heirarchy:
-company
-name
-city
-employee1
-name
-planet
-employee2
-name
-planet
I have created a component CompanyDetailsComponent
and another EmployeeDetailsComponent
I want to reuse the EmployeeDetailsComponent
with formGroupName
s employee1 & employee2
Here's the code stackblitz
Actually I want to make it work for a variable number of employees I have to keep the structure flat(I can't use an array of employees, in which case I would have used the FormArray
like this)
So to achieve this flat heirarchy structure I was trying to do it for 2 employees first.
Any help would be greatly appreciated
Thank you in advance!