forkJoin
signature: forkJoin(...args, selector : function): Observable
forkJoin(...args, selector : function): ObservableWhen all observables complete, emit the last emitted value from each.
Why use forkJoin?
forkJoin?Examples
// RxJS v6.5+
import { ajax } from 'rxjs/ajax';
import { forkJoin } from 'rxjs';
/*
when all observables complete, provide the last
emitted value from each as dictionary
*/
forkJoin(
// as of RxJS 6.5+ we can use a dictionary of sources
{
google: ajax.getJSON('https://api.github.com/users/google'),
microsoft: ajax.getJSON('https://api.github.com/users/microsoft'),
users: ajax.getJSON('https://api.github.com/users')
}
)
// { google: object, microsoft: object, users: array }
.subscribe(console.log);Additional Resources
Last updated
Was this helpful?