I am trying to submit form dynamically from ts file.
Form
<form [formGroup]="mainForm" #mainFormEle (Submit)="doNothing()">
.....
</form>
and the ts
@ViewChild('mainFormEle',{static:false}) mainFormEle
doNothing(){
..
console.log('came in')
..
}
mainFunc(){
..
this.mainFormEle.nativeElement.submit()
..
}
But the above block reloads the page on submit. And never goes into doNothing(). Also tried with (ngSubmit) and (onSubmit)