Angular - Submit a form programmatically.
I have a form group on the HTML and I want the component to submit the form\'s action with an email field in a post method. Ins
I think you should get ngForm in your code. So, rewrite your code as follows:
and in your ts file:
@ViewChild('testForm') testFormElement: NgForm;
public testMethod(): void {
// Below: This works for me.
this.testFormElement.ngSubmit.emit();
}
public yourSaveMethod(): void {
// post your model here.
}