简体   繁体   中英

.catch does not exist on type Observable<Response>

.catch有错误

我使用的2个catch语句,但没有一个是有效的

I am trying to access .catch from service to use it as a method of Observables and access it in the component but it is showing error. can somebody tell me how to do it?

你应该使用带有pipe() catchError

this.http.delete().pipe(catchError(e => of(e)));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM