0

I'm working with Angular and rxjs 5.5 and I'm trying to get this code to work with the new pipe operator.

this.store
  .select(state => state.userState)
  .filter(userState => userState.loaded)
  .do(userState => do_something)
  .takeWhile(userState => !userState.loaded)
  .subscribe();

So basically, wait until the user is loaded, then do something and terminate the observable. It would be something like this:

this.store
  .select(state => state.userState)
  .pipe(
    filter(userState => userState.loaded),
    do(userState => do_something),
    takeWhile(userState => !userState.loaded)
  )
  .subscribe;

but it seems the do operator is not in the operators list anymore, so how can I achieve that? I don't want to use take(1) or similar.

Thanks!

David
  • 3,364
  • 10
  • 41
  • 84
  • 4
    Possible duplicate of [How would I use \`do\` as an RxJS lettable operator?](https://stackoverflow.com/questions/48025965/how-would-i-use-do-as-an-rxjs-lettable-operator) – jonrsharpe Jan 11 '18 at 10:49

1 Answers1

1

The do operator is renamed to tap, starting from rxjs 5.5.