【发布时间】:2016-12-29 10:52:05
【问题描述】:
我在我的 Ionic 应用程序中使用了 auth().onAuthStateChanged() 所以当用户登录时,应用程序转到用户配置文件 $state 但问题是,因为观察者不断检查我无法检查的更改更改 $state,每当我尝试时,它都会更改回用户配置文件 $state。
firebase.auth().onAuthStateChanged(function(user) {
$scope.currUser = user;
if (user) {
$scope.go('profile') //function to change states.
} else {
// No user is signed in.
$scope.go("login") //login is where the app starts (login page)
}
});
现在,当我处于配置文件 $state 并尝试转到另一个状态时 - 例如仪表板,它会在一秒钟内自行返回到配置文件状态。
请帮我解决这个问题并提前感谢
【问题讨论】:
标签: angularjs ionic-framework firebase firebase-authentication