I have successfully built a page where it has two forms. I'm having difficulty on how to separate the two forms into separate components. I already added components for each forms. How would I do it the recommend and correct way?
Pls check my stackblitz here CLICK HERE
this.personalDetails = this.formBuilder.group({
name: ["", Validators.required],
email: ["", Validators.required],
phone: ["", Validators.required],
});
this.addressDetails = this.formBuilder.group({
city: ["", Validators.required],
address: ["", Validators.required],
pincode: ["", Validators.required],
});
To divide a large .html in two components you can make in three steps
@Input
, so. e.g. for "personal-info" you need @Input() personalDetails:FormGroup
@Input() personal_step = false;
@Output() next:EventEmitter<any>=new EventEmitter<any>()
"*ngIf="step==1"
and
change the (click)="next()"
to use the Output <input (click)="next.emit(null)" .../>
I forked your stackblitz here