AngularJS / Firebase - Need to login twice for a s

2019-09-04 12:00发布

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条回答
Rolldiameter
2楼-- · 2019-09-04 12:39

You need to apply digest cycle after receiving an event.

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

Forked Plunkr

查看更多
登录 后发表回答