All you need to know about combineLatest operator in RxJS

  • Passing an empty array will result in an Observable that completes immediately.
  • If an error emitted from one observable, the combineLatest throws an error and completes.
  • Emits values, if at least one input observable emits.
const ob1$ = interval( 1000 ).pipe(take( 4 ));const ob2$ = of( 5 , 6 , 7 , 8 );const ob3$ = timer( 1000 , 1000 ).pipe(take( 4 ));combineLatest(ob1$, ob2$, ob3$).subscribe(val => console.log(val));
// [0, 8, 0]// [1, 8, 0]// [1, 8, 1]// [2, 8, 1]// [2, 8, 2]// [3, 8, 2]// [3, 8, 3]

--

--

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