Is there a way to submit a form in parts and together? I have a large form with multiple key combinations that need to be sent when editing fields separately. These parts are also utilized in various sections of the application. How can I make the forms independent yet cohesive, allowing for individual submissions as well as one unified submission? To illustrate, I've created two small examples. I'm looking to create a modular approach to avoid code repetition. However, I'm unsure how to divide the smaller forms into child components that can be edited and submitted individually with separate buttons, while still having an option to submit everything at once.
constructor(private fb: FormBuilder) {
this.form1 = this.fb.group({
age: [20],
name: ['asdas']
});
this.form2 = this.fb.group({
adress: ['20'],
city: ['Kiev']
});
this.form3 = this.fb.group({
age: [20],
name: ['asdas']
adress: ['20'],
city: ['Kiev']
});
}
public onSubmit1(): void {
// logic for form 1
}
public onSubmit2(): void {
// logic for form 2
}
public onSubmit3(): void {
// logic for form 3
}