【发布时间】:2013-11-06 20:07:05
【问题描述】:
我正在尝试的是:登录时,将配置文件信息添加到范围,然后在注销时使用取消关联回调(取消绑定),这样一个用户的垃圾不会与下一个用户混合。
它在初始登录时有效,但在注销后,登录失败。有什么建议么?总的来说,我已经注意到这一点。
$scope.$on('angularFireAuth:login', function(){
//attach current profile info to scope
angularFire(fbUrl + 'profiles/user-' + $scope.auth.id , $scope, "profile",{}).
then(function(unbind){
console.log($scope.profile);
$scope.$on('angularFireAuth:logout', function(){
//detach current profile info from scope
unbind();
});
});
});
【问题讨论】:
-
另外..有没有更好的方法来使用回调。
-
登录失败怎么办?没有用户能够进行身份验证?
-
**** 它没有失败。我的测试数据有重复值。抱歉@Hiattp .. 感谢您抽出宝贵时间。
-
Np,我建议将该事件侦听器从回调中取出,只是为了清理它。
标签: angularjs firebase angularfire