本文整理匯總了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));
}