This may be a simple join but I am having issues getting this to work correctly. I will show the current code I'm working with. Although I've made a lot of changes with no good result.
I am looking to get the 'ID(s)' from the results of an Http get call and then using those ID(s) in another Http get call using a for loop and saving the results in one array....
The idea is to get the results from each for loop and store the results into one array.....hopefully that makes sense, thanks.
component.ts
array1: any[];
entryResult: any[];
Id:any;
ngOnInit() {
this.xService.getAll()
.subscribe(entryResult=> {
this.entryResult= entryResult;
for (let i of this.entryResult) {
this.Id = i.id;
this.array1.push(this.xService.getStuff(this.Id))
forkJoin(this.array1).subscribe((res => {
console.log(res);
}))
}
})
forloop? You are better off usingasyncandawaitthen subscriptions.