I need to retrieve an array of objects through a request. Each object in the array has an id, which I then use to make another request. After receiving the result, I want to filter the original array based on this information. Here is a simplified example:
function getAllObjects(): Observable<{ id: number }[]> {
return of([
{ id: 1 },
{ id: 2 },
{ id: 3 },
{ id: 4 },
]);
}
function checkObject(obj): Observable<boolean> {
return of(obj.id % 2 === 0);
}
getAllObjects().pipe(
// TODO
).subscribe(console.log); // My goal is to only display objects that pass the async check