Я хочу разделить несколько HTTP-запросов на один наблюдаемый, вызвать его по интервалам и поделиться одними и теми же данными между всеми подписчиками.
Мой код пока выглядит так:
import {Observable} from "rxjs/Rx";
let obs = Observable
.interval(10000)
.publish()
.connect()
.forkJoin(
this.http.get(API_URL + "x", {headers: this.headers})
.map(response => response.json()),
this.http.get(API_URL + "y", {headers: this.headers})
.map(response => response.json())
)
.map(res => {
// do some stuff
return res;
});
Ошибка:
Typescript Error
Property 'forkJoin' does not exist on type 'Subscription'.
Я прочел:
https://blog.oughttram.io/angular/2016/06/16/cold-vs-hot-observables.html
https://stackoverflow.com/questions/38842832/multiple-http-requests-in-ionic2
Спасибо!