angularjs - Angular Error: $injector:unpr Unknown Provider -


i getting followin error

error: [$injector:unpr] unknown provider: authprovider <- auth <- loginctrl 

and code looks following...

'use strict';  angular.module('yapp')   .controller('loginctrl', function($scope, $location,auth,$log) {      $scope.submit = function(email,password) {          var model = {             email:'',             password:''         };          $scope.model = model;            auth.login(email,password)               .then(function(token){                     $log.info(token);               },function (error){                     $log.info(error);           });     }    }); 

'use strict';

angular.module('yapp') .factory('auth', function($http,$q,$log,apihelper) {

var self = this;    this.login = function(email,password){       var d = $q.defer();       var requesturl = apihelper.endpoints.login;       var data = {           email:email,           password:password       };       $http({           url:requesturl,           datatype: 'json',           method: 'post',           data:data,           headers: {               "content-type": "application/json"           }       })           .success(function(data,status,headers,config){               d.resolve(data);           })           .error(function(data,status,headers,config){               d.reject(data);           });       return d.promise;   }  return self; 

});

this happens when haven't included file in have defined service. sure did script import or module.export that?


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -