【发布时间】:2017-08-15 23:47:35
【问题描述】:
我目前正在学习 Angular 2,参加 Deborah Kurata 的 Pluralsight 课程(Angular 2:入门)。到目前为止它很棒,但是,对于我的生活,我似乎无法发现我的 .catch 的返回类型应该是什么。在她的课程中,以及到目前为止我找到的每个示例中,返回类型都是空白的。
这就是我所拥有的:
getProducts(): Observable<IProduct[]> {
return this._http.get("someurl")
.map {.....}
.catch(this.handleError);
}
handleError (response: Response) **/*what goes here?*/** {
// the code in the course says Observable.throw, but chrome is
// complaining that there is no such function. I have tracked
// down "static throw: typeof ErrorObservable.create;" in
// Observable.ts but I'm not sure what's going on here.
}
【问题讨论】:
标签: angular typescript exception-handling rxjs angular2-observables