I have an array , and i want to loop through the array and call server data on each item . I want to show a spinner as api is being in pending state as i load the page.
Current solution:
getRecordings(classroom) {
return this.sysAdminService.getMeetingRecordings(classroom.meeting_id).subscribe(res => {
classroom.recordings = res;
});
}
Api calls:
this.classRoomsToDisplay.map((classroom) => {
classroom.showAttendees = false;
classroom.recordings = null;
this.getRecordings(classroom);
});
As above im subscribing to the observable for each item in an array .I want to find if there is any better way to do this using rxjs , concatMap? i dont want to wait for the api calls for the entire array to be completed , i want to display the result as soon as the api call for that item is completed.