title: How to communicate between functions with observable
body: <p>I have function that callPhantom to render pdf, and i need to wait until all components load.
  This is the function: </p>
  
  <pre><code> this.http.get&lt;[any]&gt;("api/funds").subscribe(async funds =&gt; {
            for (let i = 0; i &lt; funds.length; i++) {
              this.fund = funds[i];
              // here i need to wait until onChartLoad fired.
              await new Promise(resolve =&gt; setTimeout(() =&gt; resolve(), 4000));
              await (&lt;any&gt;window).callPhantom({ id: this.fund.fileName });
            }
            await (&lt;any&gt;window).callPhantom();
          })
  </code></pre>
  
  <p>I have function 'onChartLoad' that fired after finish load chart.
  I need to continue with loop to print all funds, 
  So which type of observable appropriate to my case?</p>
  
  <p>I try to use Subject, and cast it to promise:</p>
  
  <pre><code>await this.renderObservable.take(1).toPromise();
  </code></pre>
  
  <p>But then it wait just one time.</p>
  
  <p>Add </p>
  
  <pre><code> this.renderObservable = new Subject();
  </code></pre>
  
  <p>After that solve my problem, but i don't think is that the best way.</p>