title: Angular4 - post form data to rest api
body: <p>How is it possible to post form data to an external rest api?</p>
  
  <p>At the moment i have an html form:</p>
  
  <pre><code>&lt;form [formGroup] = "form" (ngSubmit) = "onSubmit(form.value)"&gt;
    &lt;input name="name" formControlName="name"&gt;
    &lt;input name="first_name" formControlName="first_name"&gt;
    &lt;input name="last_name" formControlName="last_name"&gt;
    &lt;button type="submit"&gt;Save&lt;/button&gt;
   &lt;/form&gt;
  </code></pre>
  
  <p>and then i have the function that is handling the submit in my component.ts file:</p>
  
  <pre><code>  onSubmit = function (user) {
      console.log(user);
      //this.http.post('http://xxx/externalapi/add', user);
    }
  </code></pre>
  
  <p>But how is it possible to post the form data to my external api? And what is the standard of sending form data with angular? Is it just a simple post request with form data as queryParams or is it standard to convert it into JSON. I can modify the api to handle whatever data is sent so thats not a problem.</p>