ConcatMap

Map values to inner observable, subscribe, and emit in order. Projects each source value to an Observable which is merged in the output Observable, in a serialized fashion waiting for each one to complete before merging the next.

Returns an Observable that emits items based on applying a function that you supply to each item emitted by the source Observable, where that function returns a (so-called "inner") Observable. Each new inner Observable is concatenated with the previous inner Observable.

fromEvent(saveBtn, 'click')
  .pipe(concatMap(click => save()))
  .subscribe(result => {
    // result is the result of save()
  });

Last updated