title: Call function in child component only after function in parent component is completed
body: <p>I have an HTTP function that needs to be called only once and all child components are dependent on this function. So I am making this function call from parent component.</p>
  
  <p>Now before making any call in ngOnInit of any of the child component I need to check whether parent function is successfully executed else wait until parent function gets response back from http call (server):</p>
  
  <blockquote>
    <ul>
    <li>Parent Component <br/>
    
    <ul>
    <li>Child Component 1</li>
    <li>Child Component 2</li>
    <li>Child Component 3</li>
    </ul></li>
    </ul>
  </blockquote>
  
  <p>Parent component making call to service function <br/>
  Child component must wait until parent function is executed</p>
  
  <p>Parent Component</p>
  
  <pre><code>main(): void {
      this.backendService.main().subscribe(res =&gt; {
          this.sharedDataService.setParentData(res);
          this.data = res;
      });
  }
  
  ngOnInit(): void {
      this.main();
  }
  </code></pre>
  
  <p>Child Component</p>
  
  <pre><code>child(): void {
      let parentData = this.sharedDataService.getParentData();
      this.backendService.child(parentData).subscribe(res =&gt; this.childData = res);
  }
  
  ngOnInit(): void {
      this.child();
  }
  </code></pre>
  
  <p>backendService - makes http calls <br/>
  sharedDataService - has data which is shared across all components</p>
  
  <p>But this.backendService.child function gets called even before this.backendService.main function http call receives response. Is there any way to achieve this?</p>