title: Iterating over array created from subscribe function of Observable
body: <p>I have this code that gets some data from a MongoDB and saves it in an array in my component. </p>
  
  <pre><code>this.laugService.getAllLaug().subscribe(laug =&gt; {
    this.laugs = laug; //save posts in array
  });
  
  this.laugs.array.forEach(element =&gt; {
    this.modelLaugs.push(new Laug(element.navn, element.beskrivelse))
  });
  </code></pre>
  
  <p>After that i want to save this data to a different array, where i create new instances of my model "Laug". For this i am using a foreach loop, however i am getting an error when running this code: </p>
  
  <pre><code>ERROR Error: Uncaught (in promise): TypeError: Cannot read property 
  'forEach' of undefined
  TypeError: Cannot read property 'forEach' of undefined
  </code></pre>
  
  <p>I am certain that i receive the data from the DB, however i am unsure why my array is undefined at this point.</p>