title: SyntaxError: Illegal return statement in Angular application
body: <p>I'm getting <strong>SyntaxError: Illegal return statement</strong> while running beow code in last line of code(<strong>return</strong> statement). And after executing last line, I'm getting <strong>TypeError: Cannot read property 'post' of undefined</strong> error.</p>
  
  <pre><code>constructor(private _http:Http);
  createCategory(vm: Category): Observable&lt;any&gt;{  
  vm.Id = 25;
  var body = JSON.stringify(vm);
  var headerOptions = new Headers({ 'Content-Type': 'application/json' });   
  return this._http.post('http://localhost:55861/api/CategoryApi', body, {headers: headerOptions }).map(x =&gt; x.json());
  } 
  </code></pre>
  
  <p>I'm running Angular project in visual studio. The above code is for posting the data to web api POST action method. Can anyone help me out?..</p>