Multi-thread programming in Angular

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

Written by

Welcome to my Data Science blog. Please visit my career portfolio at https://mruanova.com 🚀🌎

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store