Multi-thread programming in Angular

Mau Rua
1 min readJan 9, 2018

--

In Angular you can create an array of observables and subscribe to them using ForkJoin which will wait until all the threads are complete:

let obsArray: Observable<Object1 | Object2>[] = [];
obsArray.push(myObject1);
obsArray.push(myObject2);
Observable.forkJoin(obsArray).subscribe(
responses => {console.log('both completed successfully!');},
error => {console.log('error');}
);

Video https://youtu.be/gPlAq-FR5VE

Reactive-Extensions / RxJS: forkjoin

--

--

Mau Rua
Mau Rua

Written by Mau Rua

Welcome to my software engineering blog. Please visit my career portfolio at https://mruanova.com πŸš€πŸŒŽ

No responses yet