本文整理匯總了TypeScript中ngx-restangular.Restangular.all方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Restangular.all方法的具體用法?TypeScript Restangular.all怎麽用?TypeScript Restangular.all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ngx-restangular.Restangular
的用法示例。
在下文中一共展示了Restangular.all方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getFeaturedDish
getFeaturedDish(): Observable<Dish> {
// restangular.all('dishes') find all information from /dishes
// getList({featured: true}: find all information of dishes where featured=true
// pipe: use the dishes array provide by last step as a parameter to execute map
// map: take dishes parameter, return the first one of this
return this.restangular.all('dishes').getList({featured: true}).pipe(map(dishes => dishes[0]));
}
示例2: getFeaturedPromotion
getFeaturedPromotion(): Observable<Promotion> {
return this.restangular.all('promotions').getList({featured: true})
.map(promotions => promotions[0]);
}
示例3: getDishes
//return in array of dishes
getDishes(): Observable<Dish[]> {
// restangular.all: would make HTTP request use baseURL+'/dishes' as root source and get all the data from it.
// baseURL is defined in restConfig.ts
return this.restangular.all('dishes').getList();
}
示例4: getFeaturedLeader
getFeaturedLeader(): Observable<Leader> {
return this.restangular.all('leaders').getList({featured: true})
.map(leaders => leaders[0])
.catch(error => { return error; } );
}
示例5: getPromotions
getPromotions(): Observable<Promotion[]> {
return this.restangular.all('promotions').getList();
}
示例6: submitFeedback
submitFeedback(feedback: Feedback): Observable<Feedback> {
return this.restangular.all('feedback').post(feedback);
}
示例7: getLeaders
getLeaders(): Observable<Leader[]> {
return this.restangular.all('leaders').getList()
.catch(error => { return error; } );
}
示例8: submitFeedbacks
submitFeedbacks(feed : Feedback): Observable<Feedback[]> {
console.log("Feedback from service" +feed);
return this.restangular.all('feedback').post(feed);
}
示例9: newPassword
newPassword(code: string, password: string, password_confirmation: string): Promise<noosfero.RestResult<noosfero.User>> {
return this.restangular.all("").customOperation("patch", "new_password", { code: code, password: password, password_confirmation: password_confirmation }).toPromise();
}
示例10: getFeaturedDish
getFeaturedDish(): Observable<Dish> {
return this.restangular.all('dishes').getList({featured: true})
.map(dishes => dishes[0]);
}