title: assigned value to local variable inside subscribe()
body: <p>I am making <code>http post</code> and then trying to assign value to local variable inside subscribe.</p>
  
  <p>However that local variable line of code gets never called. Why ? Whats wrong with my code? </p>
  
  <p>This is my component </p>
  
  <pre><code>submitted = false;
  
      onSubmit() {
      this.leaveService.addLeave(this.model)
          .subscribe(res =&gt; {
              this.submitted = true;  **// This line of code never execute. Why?**
  
          });
  
      }
  </code></pre>
  
  <p>This is my service</p>
  
  <pre><code>addLeave(body: leave): Observable&lt;leave[]&gt; {
  let bodyString = JSON.stringify(body); // Stringify payload
  let headers = new Headers({ 'Content-Type': 'application/json' }); // ... Set content type to JSON
  let options = new RequestOptions({ headers: headers }); // Create a request option
  
  return this.http.post(this._apiUrl, body, options)
      .map(res =&gt; res.json())
      .catch((error: any) =&gt; Observable.throw('Error'));
  }
  </code></pre>
  
  <p>My MVC controller method (Just added simple one to ensure round trip is fine)</p>
  
  <pre><code>[HttpPost("[action]")]
  public IActionResult CreateLeaveRequest([FromBody] LeaveModel leave)
  {
      return StatusCode(200);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I don't see any error in console. 
  Let me know if you need more information to understand the problem.</p>
  
  <p><strong>Note:</strong></p>
  
  <p>onSubmit() definitely called. the sequence is it calls OnSubmit(), which calls addLeave from service, that sends the request to controller method (debug point hit) .</p>