Javascript $firebaseAuthProvider<;-$firebaseAuth<;-认证
我已经在Firebase中创建了1个用户帐户,我只需要对其进行身份验证,但出现如下错误Javascript $firebaseAuthProvider<;-$firebaseAuth<;-认证,javascript,angularjs,firebase,firebase-authentication,Javascript,Angularjs,Firebase,Firebase Authentication,我已经在Firebase中创建了1个用户帐户,我只需要对其进行身份验证,但出现如下错误 $firebaseAuthProvider您不需要注入$firebaseAuth您只需直接使用firebase。见: 您使用的Firebase和AngularFire版本是什么? var mypractice = angular.module("firebase.appauth", ['practicecontroller','firebase','ngRoute','ngMessages' ]);
$firebaseAuthProvider您不需要注入$firebaseAuth
您只需直接使用firebase
。见:
您使用的Firebase和AngularFire版本是什么?
var mypractice = angular.module("firebase.appauth", ['practicecontroller','firebase','ngRoute','ngMessages' ]);
mypractice.factory("Auth", ["$firebaseAuth",
function($firebaseAuth) {
var ref = $firebaseAuth(new Firebase("https://firabaseurl.com"));
return $firebaseAuth(ref);
}
]);
practicecontroller.controller("loginctrl", ['$scope', '$http', 'Auth', function ($scope, $http, Auth) {
$scope.auth = Auth;
$scope.auth.$onAuth(function (authData) {
$scope.authData = authData;
});
$scope.login = function () {
Auth.$authWithPassword({
email : $scope.username,
password : $scope.password
})
.then(function (authData) {
console.log('Logged in as:', authData.uid);
window.location.href = "#/login/home"
})
.catch (function (err) {
console.log('error:', err);
//$state.go('login');
});
};
firebase.auth()...