Angular 6 rxjs 超时 - 超时不是函数
Angular 6 rxjs timeout - timeout is not a function
我正在尝试在我的一个 http post 中使用超时。我得到错误
ERROR TypeError: this._http.post(...).timeout is not a function
代码如下所示:
return this._http.post(this.meetingProcessURL, body )
.timeout(5000)
.catch( err => {
return Observable.throw("Timeout has occurred");
})
.pipe(catchError(this.handleError));
}
我正在使用 angular 6 和 rxjs 6.0.0
"@angular/core": "^6.1.0",
"rxjs": "^6.0.0",
"rxjs-compat": "^6.0.0",
我做错了什么?
参考:
试试这个:
return this._http.post(this.meetingProcessURL, body )
.pipe(
timeout(5000),
catchError( err => {
return throwError("Timeout has occurred");
})
}
由于 rxjs@5.5
运算符不属于 Observable.prototype
,主要是出于性能原因。阅读更多 here
我正在尝试在我的一个 http post 中使用超时。我得到错误
ERROR TypeError: this._http.post(...).timeout is not a function
代码如下所示:
return this._http.post(this.meetingProcessURL, body )
.timeout(5000)
.catch( err => {
return Observable.throw("Timeout has occurred");
})
.pipe(catchError(this.handleError));
}
我正在使用 angular 6 和 rxjs 6.0.0
"@angular/core": "^6.1.0",
"rxjs": "^6.0.0",
"rxjs-compat": "^6.0.0",
我做错了什么?
参考:
试试这个:
return this._http.post(this.meetingProcessURL, body )
.pipe(
timeout(5000),
catchError( err => {
return throwError("Timeout has occurred");
})
}
由于 rxjs@5.5
运算符不属于 Observable.prototype
,主要是出于性能原因。阅读更多 here