title: Angular 2 get data from ID using web api
body: <p>I have web API method to get data from EmpID and I call this method from Angular 2 and want to bind data to form to update that.</p>
  
  <p>I think I do not call web API method correctly from service,
  but it gives error that we cannot find this web API method. </p>
  
  <p>Web API method:</p>
  
  <pre><code>    [ Route("api/Employee/GetEdit/{id:int}") ]       
      public Employee GetEdit(int id) {
          return db.Employees.Where(t =&gt; t.EmpID == id).FirstOrDefault();
      }
  </code></pre>
  
  <p>Below is my service:</p>
  
  <pre><code> GetEdit(id:any) {
      let headers = new Headers({ 'Content-Type': 'application/json', 'Accept': 'application/json' });
      let options = new RequestOptions({ headers: headers });
      return this.http.get('http://localhost:49221/Employee/GetEdit/' + id,  headers)
          .map((res: Response) =&gt; res.json());
  
      //return this.http.get('http://localhost:49221/api/Employee')
      //    .map(this.extractData)
      //    .catch(this.handleError);
  }
  </code></pre>
  
  <p>Below is my component class:</p>
  
  <pre><code> getEdit() {
      this._service.GetEdit(1).subscribe(              
          posts =&gt; this.employee = posts,
          error =&gt; console.error(error)
      )};
  </code></pre>