title: Angular 2: How to call a function after get a response from subscribe http.post
body: <p>I need to call a method after get the data from the http post request </p>
  
  <p><strong>service: request.service.TS</strong></p>
  
  <pre><code>get_categories(number){
   this.http.post( url, body, {headers: headers, withCredentials:true})
      .subscribe( 
        response =&gt; {
          this.total = response.json();
  
        }, error =&gt; {
      }
    ); 
  
  }
  </code></pre>
  
  <p><strong>component: categories.TS</strong> </p>
  
  <pre><code>search_categories() {
  
  this.get_categories(1);
  //I need to call a Method here after get the data from response.json() !! e.g.: send_catagories();
  }
  </code></pre>
  
  <p>Only works if I change to:</p>
  
  <p><strong>service: request.service.TS</strong></p>
  
  <pre><code>get_categories(number){
   this.http.post( url, body, {headers: headers, withCredentials:true})
      .subscribe( 
        response =&gt; {
          this.total = response.json();
          this.send_catagories(); //here works fine
  
        }, error =&gt; {
      }
    ); 
  
  }
  </code></pre>
  
  <p>But I need to call the method <code>send_catagories()</code> inside of component after call <code>this.get_categories(1);</code> like this</p>
  
  <p>component: categories.TS </p>
  
  <pre><code>search_categories() {
  
  this.get_categories(1);
  this.send_catagories(response);
  }
  </code></pre>
  
  <p>What I doing wrong?</p>