title: How do I make processData function wait for the results from my getData function in Angular?
body: <p>My getData function makes an api call, then puts each returned object into an array. The array is then returned. I now need my processData function to await the results from the getData function and then further process it. Currently I dont get any results when I <code>console.log(cleaningData)</code>What am I doing wrong with async/await? What am I missing?</p>
  <pre><code>
  getData() {
   var dataBucket = [] 
   this.https.get('https:******FAKEURL*******').subscribe((response: any) =&gt; {
      console.log(response.data)
      for(let i = 0 ; i &lt; response.data.length ; i++) {
         dataBucket.push(response.data[i])
      }
    });
    console.log(dataBucket);
    return dataBucket;     
   }
  
  async processData() { 
    let cleaningData = await this.getData();
    console.log(cleaningData);
    //do something with cleaningData
  }
  
  </code></pre>