我有以下工厂功能:
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();