title: How to submit reactive form from outside the form [submitting on click save or update buttons outside the form]
body: <p>I am working on reactive forms in angular 7, and I need to call submit from a button outside the form. </p>
  
  <pre><code>&lt;input type="button" form="ngForm"  class='Button' value="Save" (click)="detailForm.ngSubmit.emit()" /&gt;
  
  &lt;form [formGroup]="gDetailForm" (ngSubmit)="onSubmit()" &gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This function is working fine.</p>
  
  <p>Now, I need to submit the form from multiple buttons i.e. </p>
  
  <ul>
  <li>if user click Save button, the form should be submitted and save  </li>
  <li>if user click Update button, the form should be submitted and update</li>
  </ul>
  
  <p>For this purpose, I want to pass a flag 'Save' or 'Update' from</p>
  
  <pre><code>&lt;input type="button" form="ngForm"  class='Button' value="Save" (click)="detailForm.ngSubmit.emit('Save')" /&gt;
  
  &lt;input type="button" form="ngForm"  class='Button' value="Update" (click)="detailForm.ngSubmit.emit('Update')" /&gt;
  
  &lt;form [formGroup]="gDetailForm" (ngSubmit)="onSubmit(flag)" &gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>But I could not submit the form with the 'Save' / 'Update' flag. <strong>How could I pass a parameter from Save and Update buttons outside the form to my submit function.</strong></p>
  
  <p>Any fruitful suggestion would be highly appreciated.</p>