2

在我的离子(角)的应用程序,Angularfire:如何等待firebase加载?

  1. 我如何可以等待火力加载?
  2. 我想根据用户身份验证或不验证来更改应用程序状态。

当前,firebase.auth().currentUser返回为空。

$ionicPlatform.ready(function(){ 
    firebase.auth().currentUser --> null 
}); 

.controller('MyController', function($scope, $ionicPopup, $firebaseAuth) { 
    $scope.$on('$ionicView.afterEnter', function(e) { 
     firebase.auth().currentUser --> is valid  
    }); 
}); 
+0

参见[检索认证状态]的文件(https://github.com/firebase/angularfire/blob/master/docs/guide/user-auth.md#检索身份验证状态)和[使用路由器进行身份验证](https://github.com/firebase/angularfire/blob/master/docs/guide/user-auth.md#authenticating-with-routers)。 –

回答