Probably a basic question, but I have an Angular app that makes a backend service call to retrieve some data and then uses that data to make another backend service call.
The second service call is dependent on the first completing successfully, so I use the concatMap() function from RxJS.
However, my code below is only returning the data for the second service call. I need all the data returned from both service calls.
Have a feeling I'm messing up the .pipe call, but not making much progress. Thanks in advance.
getData(id: String): Observable<any[]> {
return this.http.get<any>(`${this.baseUrl}/path/${id}`).pipe(
concatMap(
evt =>
<Observable<any[]>>(
this.http.get<any[]>(
`${this.baseUrl}/path/relatedby/${evt.child_id}`
)
)
),
retry(3),
catchError(this.handleError("getData", []))
);}