AngularJS / Firebase - Need to login twice for a successful login

347 views Asked by At

I have simple AngularJS app and using Firebase OpenAuth for user authentication. Here is a sample code from plunkr.

  [http://plnkr.co/edit/ZVfkaJF0g3E5u63J7uHx?p=preview][1]

I have to click twice to authData from Google. I don't understand, why I can't get the data on the first click.

1

There are 1 answers

0
Pankaj Parkar On BEST ANSWER

You need to apply digest cycle after receiving an event.

$rootScope.$auth.$onAuth(function(authData){
     $rootScope.authData = authData;
     $scope.$apply();
});

Forked Plunkr