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