问题
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:
You need to apply digest
cycle after receiving an event.
$rootScope.$auth.$onAuth(function(authData){
$rootScope.authData = authData;
$scope.$apply();
});
Forked Plunkr
来源:https://stackoverflow.com/questions/30900668/angularjs-firebase-need-to-login-twice-for-a-successful-login