尝试从 angular 5.2 升级到 angular 6.0.0,我们遇到了以下错误:
error TS2339: Property 'do' does not exist on type 'Observable<
任何想法为什么?
我们使用的代码是
return this.httpClient.post<x>(`${environment.apiUrl}auth/x/`,
this.abcd,
httpOptions)
.do(x1 => this.subject.next(x1))
最佳答案
链操作符不久前被弃用,现在它们已被删除。使用可管道操作符,在本例中 tap
替换 do
.
import { tap } from 'rxjs/operators';
return this.httpClient.post(ˋ${environment.apiUrl}auth/x/ˋ, this.abcd, httpOptions)
.pipe(
tap(x1 => this.subject.next(x1))
);
关于angular - 错误 TS2339 : Property 'do' does not exist on type 'Observable<,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50195209/