Is there a way to make multiple HTTP calls simultaneously in an Angular service and then combine the responses into one object using RxJS?
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class DataService {
constructor(private http: HttpClient) {}
getData1(): Observable<any> {
return this.http.get('https://api.example.com/data1');
}
getData2(): Observable<any> {
return this.http.get('https://api.example.com/data2');
}
}