title: how to post reactive form data to REST API
body: <p>I built angular reactive form on top of REST API and I need to submit (POST) the data to the API. </p>
  
  <p>this is my POST function in the service class </p>
  
  <pre><code>postHotel(h :Hotel) {
      var body = JSON.stringify(h);
      var header = new header({'content-type' : 'application/json'});
      var request = new RequestOptions({method: RequestMethod.Post , headers:header});
      return this.http.post('http://localhost:56229/api/Hotels' ,body,request).map(x =&gt; x.json());
    }
  </code></pre>
  
  <p>and this is my form </p>
  
  <pre><code>&lt;form  [formGroup]="profileForm" (ngSubmit)="onSubmit()"&gt;
      &lt;div class="form-group"&gt;
        &lt;div class="form-group col-md-6"&gt;
          &lt;label &gt;Hotel Name&lt;/label&gt;
          &lt;input class="form-control" type="text" formControlName="HotelName" required&gt;
        &lt;/div&gt; 
        &lt;div class="form-group col-md-6"&gt;
            &lt;label &gt;Owner Name&lt;/label&gt;
            &lt;input class="form-control"  type="text" formControlName="OwnerName" required&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;&lt;/form&gt;
  </code></pre>