小编Sze*_*sui的帖子

ES6功能:模板字符串如何有用?

AKA模板文字,字符串插值.(维基这里.)

它们为什么有用?

我什么时候不应该使用它们?

这些功能与使用JSX和React有何不同?

如何有效地使用String.raw(),如wiki底部所述?

javascript string-interpolation ecmascript-6

3
推荐指数
1
解决办法
566
查看次数

如何使用打字稿制作Angular服务?

我有一个使用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?我希望它能让我的控制器中的这些货币充满来自服务器的数据.

angularjs typescript

3
推荐指数
1
解决办法
4973
查看次数

如何在 MongoDB 中创建上限数组?

每次将数组添加到文档时是否会自动创建上限数组,还是必须输入命令?

这是上限集合的命令:

db.createCollection( "log", { capped: true, size: 100000 } )
Run Code Online (Sandbox Code Playgroud)

据我所知,您只需要使用该$slice命令即可。谁能证实这一点吗?

谢谢

mongodb

2
推荐指数
1
解决办法
1276
查看次数