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

你说的曾经没有我的故事 提交于 2019-12-25 02:59:37

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!