2017-07-15 2 views
0

Je crée un DATASERVICE pour gérer toutes les connexions http, voici mon code pour cela:

(function(){ 
angular.module('theswapp') 
     .factory('dataService',['$http','$q',function($q, $http){ 

     function getTeamCheckInData(){ 
      return $http.get('assets/js/data.json'); 
     } 

     return { 
      getTeamCheckInData : getTeamCheckInData 
     }; 

    }]); 
})(); 

Après l'injection dans mon contrôleur et en l'enviant je reçois une erreur à return $ http.get ('assets/js/data.json'); .Error dit $ http.get est pas une fonction

Répondre

4

Les ordres des paramètres de l'usine est mauvaise, il devrait être

angular.module('theswapp') 
     .factory('dataService',['$http','$q',function($http,$q){