title: How to loop though multiple http post requests in angular?
body: <p>I have an array of objects that are to be passed to a mongoDB model which accepts one object at a time, I tried to loop the http post requests but as it is asynchronous, that doesn't work. Any other solution?</p>
  
  <pre><code>for (let entry of ingredients) {
      const body = JSON.stringify(entry);
      console.log(body);
      const headers = new HttpHeaders({'Content-Type': 'application/json'});
      return this.http.post('http://localhost:3000/shopping-list', body, {headers: headers})
          .catch((error: Response) =&gt; Observable.throw(error));
  
  }
  </code></pre>
  
  <p>Thanks </p>