angular submit form in code code example
Example: angular submit form programmatically
// html
<form ngNoForm
[formGroup]="testGroup"
[action]='actionLink'
method='POST'
#testForm>
<input name='Email' type='hidden' [value]='currentUserEmail'>
</form>
// ts
@ViewChild('testForm') testFormElement;
public currentUserEmail: string = '';
public testGroup = this.formBuilder.group({
Email: ''
});
public testMethod(): void
{
this.testFormElement.nativeElement.submit();
}