I have an Angular code where in i am trying to subscribe to my 1st api and 
implementing a while loop inside this subscription. Further i need to 
subscribe to another api inside the while loop. Reason --> I need to 
subscribe to the inner api multiple times and the while loop should end 
based on a flag returned by inner api. I tried implementing the below but 
its not working. Need some help.

```
CallBanyanToFetchQuotes() {
    const url1 = 
'http://ws.integration.banyantechnology.com/services/api/rest/ImportForQuote';

    this.http.post(url1, payload)
      .subscribe(importForQuoteResponse => {
        this.importForQuoteResponse = importForQuoteResponse;
        console.log('LoadID = ' + 
this.importForQuoteResponse.Load.Loadinfo.LoadID);
        this.loadId = this.importForQuoteResponse.Load.Loadinfo.LoadID;

        while (!this.ratingCompleted) {
          const url2 = 
'http://ws.integration.banyantechnology.com/services/api/rest/GetQuotes';

          this.http.post(url2, payload)
            .subscribe(getQuoteResponse => {
              this.getQuoteResponse = getQuoteResponse;
              if (this.getQuoteResponse.RatingCompleted === true) {
                this.ratingCompleted = true;
              }
            });
        }
      });
  }
```

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/08db63d7-ceb9-490f-80f3-97873d0c3d37%40googlegroups.com.

Reply via email to