javascript - Cannot read error angularjs factory -


i try read particular data in distant js (available ajax calling), call factory in controller :

app.controller('paramsctrl', ['$scope', '$http', 'distantfactory', function($scope, $http, distantfactory) {       $scope.datad = distantfactory.getdistant(); }]); 

my factory :

app.factory('distantfactory', function($http, $q) {      var factory = {         distant : false,         getdistant : function() {             var deferred = $q.defer();             $http({method: 'get', url: urldatadistant, cache: false, timeout: 1500}).                 success(function(data, status) {                      /* define data */                     factory.distant = paramsfield.params[0].data.date;                     deferred.resolve(factory.distant);                   }).error(function(data, statuts) {                     deferred.reject('error');                 });             return deferred.promise;         }     }      // return     return factory; }); 

i have error :

cannot read property 'getdistant' of undefined 

distant js :

var paramsfield = {     "params" : [         {             "data" : {                 "date" : "2014-05-03"             }         }      ] } 


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -