David
David

Reputation: 3604

rxjs with the pipe operator

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!

Upvotes: 0

Views: 1565

Answers (1)

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

Upvotes: 1

Related Questions