0
我正在跟隨着錯誤
Error: [$injector:unpr] Unknown provider: AuthProvider <- Auth <- LoginCtrl
和我的代碼如下所示...
'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);
});
}
});
'使用嚴格的';
angular.module( 'YAPP') .factory( '驗證',函數($ HTTP,$ Q,$日誌,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;
});
Doy ....它已經很久了,因爲我已經做了Angular ...哇...謝謝! – TheJediCowboy