在angularJS中添加多个

在angularJS中添加多个

如何在angularJS中添加多个因素

它表明我错了

(function() {
'use strict';

angular
    .module('projectsEvaluationApp')
    .factory('EvaluationsService', EvaluationsService);
EvaluationsService.$inject = ['$resource'];

function EvaluationsService ($resource) {
    var service = $resource('api/evaluations/:id', {}, {
        'get': {
            method: 'GET',
            isArray: true
        },
        'query': {
            method: 'GET',
            isArray: true,
        }
    });

    return service;
}
  .factory('VisitService', VisitService);
})();

最佳答案

这是语法错误。 VisitService必须声明如下。

(function() {
'use strict';

    angular
        .module('projectsEvaluationApp')
        .factory('EvaluationsService', EvaluationsService) // factory one
        .factory('VisitService', VisitService); // factory two

    EvaluationsService.$inject = ['$resource'];

    function EvaluationsService ($resource) {
        var service = $resource('api/evaluations/:id', {}, {
            'get': {
                method: 'GET',
                isArray: true
            },
            'query': {
                method: 'GET',
                isArray: true,
            }
        });

        return service;
    }

    })();

关于javascript - 在angularJS中添加多个工厂,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41099407/

10-11 08:19