我有一个使用typescript和AngularJS的服务代码,如下所示:
/// <reference path='../_all.ts' />
module bankApp {
'use strict';
export class MDCurrencyService implements IMDCurrencyService {
httpService: ng.IHttpService;
promise: ng.IPromise<void>;
constructor($http: ng.IHttpService,
$q : ng.IQService) {
this.httpService = $http;
}
get(): MDCurrency[] {
var promise = this.httpService.get('/Master/CurrencyGetAll').then(function (res) {
return res.data;
});
return promise;
}
save(cur: MDCurrency) {
this.httpService.post('/Master/CurrencySave', cur);
}
softDelete(id: string)
{ }
hardDelete(id: string)
{ }
}
}
Run Code Online (Sandbox Code Playgroud)
我会像这样使用我的控制器:
this.currencies = $scope.currencies = mdCurrencyService.get();
Run Code Online (Sandbox Code Playgroud)
如何使用打字稿制作角度服务$ http?我希望它能让我的控制器中的这些货币充满来自服务器的数据.
每次将数组添加到文档时是否会自动创建上限数组,还是必须输入命令?
这是上限集合的命令:
db.createCollection( "log", { capped: true, size: 100000 } )
Run Code Online (Sandbox Code Playgroud)
据我所知,您只需要使用该$slice
命令即可。谁能证实这一点吗?
谢谢