Executing an http.get(all) after a http.post(object) in Angular2 Typescript class
<p>I have a method that should execute a http.post(object) and then, after adding a new row (object) to my DB, it should execute a http.get() for a select of the whole table AFTER adding with post. My code is here:</p>

<pre><code>getMyObj(): Observable&lt;MyObj[]&gt; {

  return this.http.get(this.myGetUrl)
      .map(this.extractData)
      .catch(this.handleError);
}

postMyObj(myObj: MyObj){
  var data= '?param1='+myObj.param1.+'&amp;param2='+myObj.param2';
  let body = JSON.stringify('json');
  let headers = new Headers({ 'Content-Type': 'application/json' });
  let options = new RequestOptions({ headers: headers });
  this.http.post(this.myPostUrl+data,body,options)
     .subscribe(()=&gt;this.getMyObj());
}
</code></pre>

<p>When i add a row in my remote table on my db i can't obtain a complete get AFTER the insert, sometimes it performs the get BEFORE the insert, or it doesn't perform get at all.</p>

<p>How to fix it? I'd like to obtain a refresh of the page in the end of the postMyObj() method, but it seems to execute get or post randomly.</p>