ngSubmit not working

I was having the same issue because I was not using a <form> tag to wrap my form.


Like I said in the comment, if your button is not inside your form it will not submit it.

So change to:

<form>
  ...
  <button type="submit">Submit</button>
</form>

It is possible however to have it outside if you do it a bit differently, as described in this question.


a small trick you can do is to place an auxiliary hidden button inside the form and let the main button programmatically click the auxiliary button:

<form [formGroup]="form" (ngSubmit)="submit()">
  ...
  <button type="submit" hidden #btn></button>
</form>
...
<button (click)="btn.click()">Submit</button>