title: rxjs - Angular: How to wait for an Observable function, to call another function that returns an Observable?
body: <p>I have 2 API calls in a service that each return an Observable, and in my component I have some condition that, if true, I must call both those functions, but I need to wait for the get() call, so that I can execute the post function with arguments returned from the get call. If false, I just want to call the post function with the already defined arguments.</p>
  <p>service:</p>
  <pre><code>  get(id: string) {
      return this.http.get&lt;any&gt;('get path');
    }
  
    post(data: data) {
      return this.http.post&lt;any&gt;('post path', {data: data});
    }
  </code></pre>
  <p>component:</p>
  <pre><code>  execute() {
      if (condition) {
        this.service.get(id).subscribe( (res) =&gt;
          // ...
          this.data = res.data;
          post(data).subscribe(() =&gt; // do stuff...);
        );
      } else { post(data).subscribe(() =&gt; // do stuff...); }
     }
  
  </code></pre>
  <p>I want to not repeat code for the post call, or if not at all possible, just not use a subscribe() inside another subscribe(). How can I do this? without async await.</p>
  <p>Thanks in advance</p>