title: Angular - Submit a form programmatically
body: <p>Angular - Submit a form programmatically.</p>
  <p>I have a form group on the HTML and I want the component to submit the form's action with an email field in a post method. Instead of using a normal submit button.</p>
  <p>Below's testMethod gets called from another button. In this method, I want to post the <strong>testForm</strong>. It has to be posted old school way as it needs an action.</p>
  <p><strong>This is my HTML:</strong></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;form
    [formGroup]=&quot;testGroup&quot;
    [action]='actionLink'
    method='POST'
    #testForm&gt;
     &lt;input name='Email' type='hidden' [value]='currentUserEmail'&gt;
  &lt;/form&gt;
  </code></pre>
  <p><strong>This is my Component TS file attempt:</strong></p>
  <pre><code>  @ViewChild('testForm') testFormElement;
  
    public currentUserEmail: string = '';
    public testGroup = this.formBuilder.group({
      Email: ''
    });
  
  
    public testMethod(): void {
  
        // Below: This currently doesnt seem to do anything.
        this.testFormElement.ngSubmit.emit();
    }
  </code></pre>