Angular 9 - how to merge 2 http.get into one Observable

Discussão em 'Angular' iniciado por Matelutex, Julho 15, 2025.

  1. Matelutex

    Matelutex Guest

    I use Angular 9 and want to merge 2 results from backend into one. My current method:

    protected getDataSource(): Observable<AgentSummary> | Refresher<any, AgentSummary> {
    return this.groupSelector.selectedGroup$.pipe(e =>
    filter(Boolean),
    switchMap((group: SelectedGroup) => this.dashboardHttp.getAgentsStatus(group.id))
    );
    }


    I want to invoke additional http.get and merge it with

    switchMap((group: SelectedGroup) => this.dashboardHttp.getAgentsStatus(group.id))

    :

    getRecoveryPoints(groupId: string): Observable<BackupSummary> {
    const headers: HttpHeaders = getHeaders(groupId);

    return this.http.get<BackupSummary>(`${this.env.URI}/backup/api/v1/dashboard/recovery-point`, {
    headers: headers,
    });
    }


    How to do that? I'm new in Angular so please be understanding for me:)

    Continue reading...

Compartilhe esta Página