q.all for angular2 observables
Angular < 6:
import {Observable} from 'rxjs/Observable';
...
return Observable.forkJoin(
this.http.get('someurl'),
this.http.get('someotherurl'));
Angular >= 6:
import {forkJoin} from 'rxjs';
...
return forkJoin(
this.http.get('someurl'),
this.http.get('someotherurl'));
You will need the .forkJoin
operator for that
Observable.forkJoin([observable1,observable2])
.subscribe((response) => {
console.log(response[0], response[1]);
});
You can import the Observable
with;
import {Observable} from 'rxjs/Rx';