2017-01-06 10 views
0

私はFirebaseに1つのユーザーアカウントを作成していると私はちょうどそれを認証する必要がありますが、 $firebaseAuthProvider <- $firebaseAuth <- Auth

マイapp.jsのようなエラーを取得:

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'); 
     }); 
    }; 
+0

使用しているFirebaseとAngularFireのバージョンは何ですか? – cartant

答えて

関連する問題