本文整理匯總了TypeScript中ngx-restangular.Restangular類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Restangular類的具體用法?TypeScript Restangular怎麽用?TypeScript Restangular使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Restangular類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: OpenfactRestangularFactory
export function OpenfactRestangularFactory(restangular: Restangular, configService: ConfigService, toastr: ToastsManager) {
const config = restangular.withConfig((RestangularConfigurer) => {
RestangularConfigurer.addErrorInterceptor((error, operation, what, url, response) => {
return OpenfactErrorInterceptor(error, operation, what, url, response, toastr);
});
RestangularConfigurer.setBaseUrl(configService.getSettings().apiEndpoint);
});
return config;
}
示例2: mapperRestangularProvider
export function mapperRestangularProvider(
restangular: Restangular,
config: ConfigService
) {
return restangular.withConfig(restangularConfigurer => {
const mapperEndpoint = config.getSettings().mapperEndpoint;
restangularConfigurer.setBaseUrl(
mapperEndpoint ? mapperEndpoint : '/mapper/v1'
);
});
}
示例3: constructor
constructor(restangular: Restangular) {
super(restangular.service('integrationtemplates'), 'integrationtemplate');
}
示例4: getAvailableBlocks
getAvailableBlocks(owner: noosfero.Profile | noosfero.Environment): Promise<noosfero.RestResult<noosfero.BlockDefinition[]>> {
let restRequest;
if (owner.type === 'Environment') {
restRequest = this.restangular.one("environments", owner.id);
} else {
restRequest = this.restangular.one("profiles", owner.id);
}
return restRequest.all("blocks").get("available_blocks").toPromise();
}
示例5: 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]));
}
示例6: restangularize
/**
* If a new item has been loaded via a websocket then lets restanguarlize it
* so that the REST APIs appear on it
*/
restangularize(item: T): T {
const restangularService = this.restangularService;
const parent = restangularService.parentResource;
const route = restangularService.route;
const fromServer = restangularService.fromServer;
const collection = restangularService.restangularCollection;
const reqParams = restangularService.reqParams;
return this.restangularService.restangularizeElement(parent, item, route, fromServer, collection, reqParams);
}
示例7: submitFeedback
submitFeedback(feedback: Feedback): Observable<Feedback> {
return this.restangular.all('feedback').post(feedback);
}
示例8: getDish
getDish(id: number): Observable<Dish> {
// restangular.one: would get information from baseURL+'/dishes'+'/:id'
return this.restangular.one('dishes', id).get();
}
示例9: getPromotion
getPromotion(id: number): Observable<Promotion> {
return this.restangular.one('promotions',id).get();
}