[英]Why using the data and error on the subscribe/observable like this is now deprecated in angular?
Why is this code deprecated?为什么不推荐使用此代码? and how is the correct form?
正确的形式如何?
getPeopleFunction() {
this.peopleService.getPeopleService().subscribe(
(data) => {
console.log(data);
},
(error) => {
console.log(error);
}
);
} }
You should use this format now:您现在应该使用这种格式:
this.peopleService.getPeopleService().subscribe({
next: (v) => console.log(v),
error: (e) => console.error(e),
complete: () => console.info('complete')
})
https://rxjs.dev/deprecations/subscribe-arguments https://rxjs.dev/deprecations/subscribe-arguments
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.