I need some assistance trying to loop through array of string numbers and assign http get requests to each string number and then assign the results to a single reactive observable. I was able to pull this off at the component level but I need the result in a observable that comes from my service. I am trying to leverage RxJs but having issues figuring out the correct syntax here. Hopefully this makes sense, thanks.
myservice
constructor(http: HttpClient)
issueNumberString: string[];
issuesObservable$;
newIssueObservable$;
private URL = '/my/api/stuff/';
getInfo() {
for (let index = 0; index < this.issueNumbersString.length; index++) {
this.https.get<any[]>(this.URL + this.issueNumbersString[index])
.subscribe((response: any) => {
return this.issuesObservable$.push(...response.records)
})
}
this.newObservable$ = this.getInfo();
}
.ts
newObservable$ = this.myservice.newObservable$;
constructor(private service: myservice)
html
<div *ngIf="newObservable$ | async as entry">
<div *ngFor="let n of entry">