When I run the linter it says:
subscribe is deprecated: Use an observer instead of an error callback
Code (from an angular 7 app with angular-cli):
this.userService.updateUser(data).pipe(
tap(() => {bla bla bla})
).subscribe(
this.handleUpdateResponse.bind(this),
this.handleError.bind(this)
);
Don't know exactly what should I use and how...
Thanks!
subscribe
isn't deprecated, only the variant you're using is deprecated. In the future, subscribe
will only take one argument: either the next
handler (a function) or an observer object.
So in your case you should use:
.subscribe({
next: this.handleUpdateResponse.bind(this),
error: this.handleError.bind(this)
});
See these GitHub issues: