export class AppComponent implements OnInit {
userSubmitted = false;
accountSubmitted = false;
userForm!: FormGroup;
ngOnInit(): void {}
onSubmit(type: string): void {
this[type + 'Submitted'] = true;
if(this[type + 'Form'].invalid)
return;
console.log(this[type + 'Form'].value);
}
I am seeking a more efficient solution to replace the need for separate onSubmitUser() and onSubmitAccount() functions.