我怎样才能回复Angular工厂的回复?

时间:2017-05-09 22:45:35

标签: angularjs

我有以下工厂功能:

var getCompanyList = function () {

    return $http.get(config.apiUrl + 'Company/GetListofCompanyNames');
};

我目前正在通过

调用它
companyService.getCompanyList().then(function(response) {
                $scope.CompanyList = response.data;
            },
            function(error) {
                $scope.errors = "Oops! Something went wrong... " + error.statusText;
            });

是否可以执行以下操作:

$scope.CompanyList = companyservice.getCompanyList();

0 个答案:

没有答案