简体   繁体   English

AngularJS / Firebase-需要登录两次才能成功登录

[英]AngularJS / Firebase - Need to login twice for a successful login

I have simple AngularJS app and using Firebase OpenAuth for user authentication. 我有简单的AngularJS应用,并使用Firebase OpenAuth进行用户身份验证。 Here is a sample code from plunkr. 这是来自plunkr的示例代码。

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

I have to click twice to authData from Google. 我必须单击两次以从Google进行authData。 I don't understand, why I can't get the data on the first click. 我不明白,为什么我第一次点击就无法获得数据。

You need to apply digest cycle after receiving an event. 您需要在收到事件后应用digest周期。

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

Forked Plunkr 分叉的Plunkr

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 angularjs 应用程序中成功登录时更改为管理员视图 - Change to admin view on successful login in angularjs application 如果Firebase登录成功,如何链接到下一页? - How to link to the next page if a Firebase login is successful? Firebase 说用户是 null 成功登录后 - Firebase saying user is null after successful login Firebase onAuthStateChanged 在登录时被调用两次 - Firebase onAuthStateChanged is being called twice upon login 登录时,Firebase onAuthStateChange会两次触发 - Firebase onAuthStateChange fire twice when login 对于Firebase简单登录,我必须登录两次才能注册 - For Firebase Simple Login, I have to login twice for it to register 仅在angularjs中成功登录并隐藏菜单后才重定向到页面 - Redirect to page only after login is successful in angularjs and hide menu angularjs ng-show:成功登录后显示菜单 - angularjs ng-show: show menu after successful login AngularJS-如果登录成功(使用不同的html页面和控制器),则在页面之间导航 - AngularJS - Navigation between pages if login is successful (with different html pages and controllers) 处理成功的node / angularjs登录而无需重新加载页面 - Handling successful node/angularjs login without reloading page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM