How to do the chain sequence in rxjs

The equivalent of then for observables would be flatMap. You can see some examples of use here :

  • RxJS Promise Composition (passing data)
  • Why we need to use flatMap?
  • RxJS sequence equvalent to promise.then()?

For your example, you could do something like :

this._myService.doSomething()
  .flatMap(function(x){return functionReturningObservableOrPromise(x)})
  .flatMap(...ad infinitum)
  .subscribe(...final processing)

Pay attention to the types of what your functions return, as to chain observables with flatMap you will need to return a promise or an observable.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)