kosnkov
kosnkov

Reputation: 5941

mergeMap service in rxjs 6

I am trying to upgrade my project based on some template from angular 5 to 6

one of the method return mergeMap in this way

return this.accountEndpoint.getUserByUserNameEndpoint<User>(userOrUserId.userName)
                    .mergeMap(user => this.deleteUser(user.id));

and some other in this way return

 this.accountEndpoint.getDeleteUserEndpoint<User>(<string>userOrUserId)
                 .do(data => this.onRolesUserCountChanged(data.roles));

unfortunately mergeMap and do does not exists on observable in rxjs 6

Couuld give me a hint how should this be mapped in new worlds of rxjs 6 ?

Upvotes: 4

Views: 5653

Answers (1)

Sam Herrmann
Sam Herrmann

Reputation: 6976

The do operator was renamed to tap, but mergeMap still exists in RxJs 6:

import { tap, mergeMap } from 'rxjs/operators'

sourceObservable.pipe(
  tap(e => ...),
  mergeMap(e => ...)
)

Upvotes: 9

Related Questions