0
votes

Using AngularFire 2.0 and calling the following code:

app.factory("Auth", ["$firebaseAuth" , "serverName",
  function($firebaseAuth,  serverName) {
    var ref = firebase.database().ref();    
    var auth = $firebaseAuth(ref);     
    return auth;
  }
]);

I get the following message:

angular.js:13550 TypeError: a.onAuthStateChanged is not a function
    at angularfire.min.js:12
    at Object.n [as promise] (angular.js:16225)
    at Object.a._initAuthResolver (angularfire.min.js:12)
    at Object.a (angularfire.min.js:12)
    at angularfire.min.js:12
    at Object.<anonymous> (default.js:6)
    at Object.invoke (angular.js:4665)
    at Object.$get (angular.js:4504)
    at Object.invoke (angular.js:4665)
    at angular.js:4464

At : var auth = $firebaseAuth(ref);

I am using the latest SDK's as is stated here:

https://github.com/firebase/angularfire/blob/master/docs/quickstart.md

1

1 Answers

3
votes

I've tried it like this

var auth = $firebaseAuth();     

and it worked for me. (note the $firebaseAuth without ref var inside). Don't take it for granted though. I don't know what the consequences might be (or maybe the docs of angularfire 2.0 are not up to date yet).