Good afternoon, I decided to try rxjs, however, I don’t really understand how to remove the resulting data from the Observable:
import {Injectable} from "@angular/core"; import {Http, Response} from "@angular/http"; import {Observable} from "rxjs/Rx"; @Injectable() export class ServiceProvider { combined:any; constructor(private http:Http) { this.loadData(); } loadData() { Observable.forkJoin( this.http.get('data/data0.json').map((res:Response) => res.json()), this.http.get('data/data1.json').map((res:Response) => res.json()) ).subscribe(res => this.combined = res); console.log(this.combined); } } Here is a small class, as a result of the work should be an array with packed data from two different requests. However, ultimately comes undefined. I understand that it is necessary to snatch some event or something else. But I can't understand with my mind.