Answers for "angular submit form programmatically"

1

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();
}
Posted by: Guest on May-14-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language