Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular .catch不存在于可观察的类型上<;回应>;_Angular - Fatal编程技术网

Angular .catch不存在于可观察的类型上<;回应>;

Angular .catch不存在于可观察的类型上<;回应>;,angular,Angular,我试图从服务中访问.catch,将其用作可观察对象的方法,并在组件中访问它,但它显示错误。 有人能告诉我怎么做吗?你应该使用catchError和pipe() Observable.throw不是一个函数尝试使用throwError而不是Observable.throwin rxjs 6 Observable不再包含运算符从“rxjs/operators”导入{catchError,throwError};您应该从'rxjs'的import{throwError}导入throwError; th

我试图从服务中访问
.catch
,将其用作可观察对象的方法,并在组件中访问它,但它显示错误。
有人能告诉我怎么做吗?

你应该使用
catchError
pipe()


Observable.throw不是一个函数尝试使用throwError而不是Observable.throwin rxjs 6 Observable不再包含运算符从“rxjs/operators”导入{catchError,throwError};您应该从'rxjs'的import{throwError}导入throwError;
this.http.delete().pipe(catchError(e => of(e)));