title: Angular/RxJS: synchronous observable
body: <p>I have a service that has a method foo. Inside the method I subscribe to  an observable (http-client).</p>
  
  <pre><code>foo () : boolean
  {
    let ret : false;
  
    this.http.get ("/blabla").subscribe (
    (resp) =&gt;
    {
      ret = true;
    }
  
    return ret;
  );
  </code></pre>
  
  <p>I like to return a boolean value from foo  that depends on the get. That is not working because http.get is asynchrouns - return is called before http.get finished.</p>
  
  <p>How can I make this synchronous? </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Returning the observable instead boolean is not an option here.
  That is because I handle the response of get in foo (not shown here) but I  also need to act out of foo depending of its return.</p>
  
  <p><strong>EDIT2</strong></p>
  
  <p>I extended my sample with pipe and tap. Now I return the http.get-observable for outside the service and I process the http.get-result with tap.</p>
  
  <pre><code>foo () : Observable &lt;any&gt;
  {
    return this.http.get ("/blabla").pipe (tap (x =&gt; handlehere ()));
  }
  </code></pre>
  
  <p>As far I see there is only one uglyness with it. I have the complexity of parsing the get-result inside AND outside of foo. I would prefer a simple boolean outside of foo.</p>