Angularjs $http.get()错误:$http.get不是函数
我正在创建一个数据服务来处理所有http连接,下面是我的代码:Angularjs $http.get()错误:$http.get不是函数,angularjs,http,angular-services,Angularjs,Http,Angular Services,我正在创建一个数据服务来处理所有http连接,下面是我的代码: (function(){ angular.module('theswapp') .factory('dataService',['$http','$q',function($q, $http){ function getTeamCheckInData(){ return $http.get('assets/js/data.json'); } r
(function(){
angular.module('theswapp')
.factory('dataService',['$http','$q',function($q, $http){
function getTeamCheckInData(){
return $http.get('assets/js/data.json');
}
return {
getTeamCheckInData : getTeamCheckInData
};
}]);
})();
在将它注入控制器并对其进行envoking之后,我在返回$http.get('assets/js/data.json')处得到一个错误.Error表示$http.get不是函数工厂中的参数顺序是错误的,应该是错误的
angular.module('theswapp')
.factory('dataService',['$http','$q',function($http,$q ){
工厂的参数顺序错误,应该是
angular.module('theswapp')
.factory('dataService',['$http','$q',function($http,$q ){