关于rxjs

来源:5-3 常见操作符(二)

alien_chen

2018-05-26

代码为:

Observable.prototype.debug = function(message: string) {    

return this.do(    

(next) => {    

if (!environment.production) {    

console.log(message, next);    

}    

},    

(err) => {    

if (!environment.production) {    

console.error('ERROR>>>', message, err);    

}    

},    

() => {    

if (!environment.production) {    

console.log('Completed - ');    

}    

}    

);    

但是这个时候报了 this.do is no a function   ; this.do 一直为undefined


写回答

3回答

接灰的电子产品

2019-06-12

安装兼容包 npm i -S rxjs-compat

0
1
DBkey_li
好的 谢谢老师,怎么加qq群,不让加
2019-06-14
共1条回复

alien_chen

提问者

2018-05-26

是rxjs 5 , 刚刚去看了api 没有do这个操作符了

0
2
接灰的电子产品
回复
DBkey_li
看最新回复
2019-06-12
共2条回复

接灰的电子产品

2018-05-26

你不会安装了 rxjs 6 了吧

0
1
DBkey_li
老师,用的rxjs 6报错》》》》ERROR Error: Uncaught (in promise): TypeError: this.do is not a function
2019-06-12
共1条回复

Angular打造企业级协作平台,让你在Angular领域中出类拔萃

全网首个介绍官方 Material 组件库用法与 Redux 在 Angular 中的应用

998 学习 · 536 问题

查看课程