$http.get() error : $http.get is not a function
$http.get() error : $http.get is not a function
我正在创建一个数据服务来处理所有 http 连接,这是我的代码:
(function(){
angular.module('theswapp')
.factory('dataService',['$http','$q',function($q, $http){
function getTeamCheckInData(){
return $http.get('assets/js/data.json');
}
return {
getTeamCheckInData : getTeamCheckInData
};
}]);
})();
将它注入我的控制器并调用它后,我在 return $http.get('assets/js/data.json'); 处收到错误.错误说 $http.get 不是函数
工厂里的参数顺序错了,应该是
angular.module('theswapp')
.factory('dataService',['$http','$q',function($http,$q ){
我正在创建一个数据服务来处理所有 http 连接,这是我的代码:
(function(){
angular.module('theswapp')
.factory('dataService',['$http','$q',function($q, $http){
function getTeamCheckInData(){
return $http.get('assets/js/data.json');
}
return {
getTeamCheckInData : getTeamCheckInData
};
}]);
})();
将它注入我的控制器并调用它后,我在 return $http.get('assets/js/data.json'); 处收到错误.错误说 $http.get 不是函数
工厂里的参数顺序错了,应该是
angular.module('theswapp')
.factory('dataService',['$http','$q',function($http,$q ){