You can use ngNoForm
with your form to remove ngForm
handling and to add plain javascript handler.
you can use your code as follows:
Html file.
<form ngNoForm
[formGroup]="testGroup"
[action]='actionLink'
method='POST'
#testForm>
<input name="Email" type="hidden" [value]='currentUserEmail'>
</form>
Ts File.
@ViewChild('testForm') testFormElement;
public currentUserEmail: string = '';
public testGroup = this.formBuilder.group({
Email: ''
});
constructor(formBuilder: FormBuilder) {
}
public testMethod(): void {
this.testFormElement.nativeElement.submit();
}