title: Angular wait data before continuing function
body: <p>Here is my code:</p>
  
  <pre><code>App-component.html
  
  &lt;router-outlet (activate)="onActivate($event)"&gt;&lt;/router-outlet&gt;
  </code></pre>
  
  <pre><code>App-component.ts
  
  node;
  ngOnInit() {
    this.loadData();
  }
  loadData() {
    return service.getData().subscribe(res =&gt; this.node = res)
  }
  onActivate(event) {
    // wait node get data then continue this function
  
  }
  </code></pre>
  
  <p>2 functions run at the same time, so is there any way to wait node get data from loadData() then continue onActivate function?</p>