In the realm of form creation, I find myself facing a dilemma with two components. My child component holds a crucial FormGroup object, defined as such:
employeeForm : FormGroup;
this.employeeForm = new FormGroup({
firstName:new FormControl(),
lastNAme:new FormControl(),
email:new FormControl()
});
The child Component only manages a fraction of the form, while the parent component houses the comprehensive form along with a submit button.
My current hurdle is this: I aim to have the Parent Component extract the FormGroup from my child component upon clicking the submit button and seamlessly integrate it into the overarching form.
To tackle this issue, I introduced an output in my child component:
@Output() onFormGroupChange: EventEmitter<FormGroup> = new EventEmitter<FormGroup>();
However, I am uncertain about how to instruct the submit button in the parent Comp to access the FormGroup object from my child component and facilitate the data transfer flow...
Any insights or suggestions on overcoming this obstacle would be greatly appreciated!
Thank you for your help.
Sincerely,