本文整理汇总了TypeScript中app/rota/config/app.App.addApi方法的典型用法代码示例。如果您正苦于以下问题:TypeScript App.addApi方法的具体用法?TypeScript App.addApi怎么用?TypeScript App.addApi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app/rota/config/app.App
的用法示例。
在下文中一共展示了App.addApi方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getTodos
interface ITodoApi extends IBaseApi {
getTodos(modelFilter?: ITodoFilter): ng.IPromise<ITodoModel[]>;
getTodoById(id: number): angular.IPromise<ITodoModel>;
save(model: ITodoModel): ng.IPromise<ICrudServerResponse>;
deleteById(id: number): ng.IPromise<any>;
}
class TodoApi extends BaseApi implements ITodoApi {
getTodos(modelFilter?: ITodoFilter): ng.IPromise<ITodoModel[]> {
return this.post<ITodoModel[]>("todo/getall", modelFilter || {});
}
getTodoById(id: number): ng.IPromise<ITodoModel> {
return this.get<ITodoModel>("todo/getbyid?id=" + id);
}
save(model: ITodoModel): ng.IPromise<ICrudServerResponse> {
return this.post<ICrudServerResponse>('todo/save', model);
}
deleteById(id: number): ng.IPromise<any> {
return this.post('todo/deletebyid?id=' + id);
}
}
//Register
App.addApi("todoApi", TodoApi);
//Export
export {ITodoApi, TodoApi}
示例2: super
super(bundle);
this.bkgModel = bkgModel;
}
getBkg(): IBooking {
return this.bkgModel;
}
getKonteynerlarByBkgId(bkgId: number): IKonteyner[] {
return this.bkgModel.konteynerlar;
}
getKonteynerById(id: number): IKonteyner {
return _.findWhere(this.bkgModel.konteynerlar, { id: id });
}
saveKonteyner(kontyener: IKonteyner): ng.IPromise<ICrudServerResponse> {
const copy = angular.copy(kontyener);
//copy.id = (_.max(this.bkgModel.konteynerlar, (item): number => {
// return item.id;
//}).id || 0) + 1;
this.bkgModel.konteynerlar.push(copy);
return this.common.promise<ICrudServerResponse>({
model: copy
});
}
}
//Register
App.addApi("BkgService", BkgService, ['bkg.model']);
//Export
export {BkgService, IBkgService}