My api returns 20 results in one http call but I want 40 records for the same I am making nested http call as shown below.I am able to fetch 40 records but when I am subscribing to the getALl() method I am getting only 20 results;
getAll() {
return this._http.get(this.baseURL)
.do((data: any) => {
this.nextPage = data.next_page_token;
var results = data.results;
return this._http.get(`${this.baseURL}?next=${this.nextPage}`).delay(2000).do((d: any) => {
return Observable.of(results.concat(d.results));
});
});
}