title: How to wait for code inside subscribe to finish before going to next iteration in forEach loop in Angular
body: <p>In the below code, I have a for loop inside that one API is getting called. I want the 1st API call to be finished and code inside subscribe fully executes first and then the next iteration of for loop will begin and again the API call will be triggered for the next iteration.</p>
  <p>But currently the APIs are executing in parallel mode. But I want the APIs to be executed in sequential manner.</p>
  <pre><code>                      parentLevelIdArray.forEach(parentLevelId =&gt; {
                          this.locModService.deleteAPI(parentLevelId, levelObj.id)
                          .subscribe((response) =&gt; {
                            if (response.status === 200) {
                              this.message = 'Image uploaded successfully';
                              this.getSublevels();
                              this.getAllLinkedLevel();
                            } else {
                              this.message = 'Image not uploaded successfully';
                            }
                          }
                          )
                        });
  </code></pre>
  <p>I have checked other stackoverflow links but didn't get the actual answer for my case. Please help.</p>