title: Angular Two buttons to submit a form but with different purpose
body: <p>I have an angular reactive form</p>
  
  <pre><code>&lt;form [formGroup]="form" (ngSubmit)="onSubmit()"&gt;
  </code></pre>
  
  <p>I have two buttons to submit. I need to perform a common operation when users press the button, that is submit the form, but also I need to differentiate between the buttons, because I need to redirect the user to different pages, depending on the button pressed.
  Here is my two buttons:</p>
  
  <pre><code>&lt;button name="Previous" type="submit" [disabled]="form.invalid"&gt; Previous&lt;/button&gt;
  &lt;button name="Next" type="submit" [disabled]="form.invalid"&gt;Next&lt;/button&gt;
  </code></pre>
  
  <p>How can I know in the OnSubmit event which button was pressed?</p>