本文整理汇总了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();
}