本文整理汇总了TypeScript中rxjs/operators.catchError函数的典型用法代码示例。如果您正苦于以下问题:TypeScript catchError函数的具体用法?TypeScript catchError怎么用?TypeScript catchError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了catchError函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: updateBook
updateBook(id: string, data: any): Observable<any> {
const url = `${apiUrl}/${id}`;
return this.http
.put(url, data, httpOptions)
.pipe(catchError(this.handleError));
}
示例2: getBooks
getBooks(): Observable<any> {
return this.http.get(apiUrl, httpOptions).pipe(
map(this.extractData),
catchError(this.handleError));
}
示例3: postBook
postBook(data): Observable<any> {
return this.http.post(apiUrl, data, httpOptions)
.pipe(
catchError(this.handleError)
);
}
示例4: GetPostHtml
GetPostHtml(url: string): Observable<string> {
// note that this.httpClient is not generic
return this.httpClient.get(this.noCache(url), {responseType:'text'}).pipe(tap(_ => this.log(`GetPostHtml`)), catchError(this.handleError<string>('GetPostHtml', null)));
}
示例5:
.pipe(mergeMap(() => ajax.getJSON<IViewData>(`api/viewdata/${selectedView.id}`).pipe(catchError(() => EMPTY))))
示例6: GetActiveSites
GetActiveSites(): Observable<Site[]> {
let url = this.serviceURL + 'GetActiveSites';
return this.httpClient.get<Site[]>(this.noCache(url)).pipe(tap(_ => this.log(`GetActiveSites`)), catchError(this.handleError<Site[]>('GetActiveSites', [])));
}
示例7: GetContentItemBySlug
GetContentItemBySlug(slug: string, siteID: number): Observable<ContentItem> {
let url = this.serviceURL + 'GetContentItemBySlug?slug=' + slug + '&siteID=' + siteID.toString();
return this.httpClient.get<ContentItem>(this.noCache(url)).pipe(tap(_ => this.log(`GetContentItemBySlug`)), catchError(this.handleError<ContentItem>('GetContentItemBySlug', null)));
//return this.http.get(this.noCache(url)).pipe(map(response => this.extractData(response)));
//.catch(this.handleError);
}
示例8: getAllFood
getAllFood(): Observable<FoodItem[]> {
return this._http.get<FoodItem[]>(this.actionUrl).pipe(catchError(this.handleError));
}
开发者ID:FabianGosebrink,项目名称:ASPNET-Foodchooser-Cross-Platform-Angular2,代码行数:3,代码来源:food-data.service.ts
示例9: getSingleFood
getSingleFood(id: number): Observable<FoodItem> {
return this._http.get<FoodItem>(this.actionUrl + id).pipe(catchError(this.handleError));
}
开发者ID:FabianGosebrink,项目名称:ASPNET-Foodchooser-Cross-Platform-Angular2,代码行数:3,代码来源:food-data.service.ts
示例10: saveEmail
saveEmail(texte){
let url = apiUrl+"/updateEmail";
return this.http.put(url,texte,httpOptions).pipe(
map(this.extractData),
catchError(this.handleError));
}