AngularJS does not update after value change

后端 未结 3 1222
没有蜡笔的小新
没有蜡笔的小新 2021-01-15 20:40

My intention is to update the navigation bar after the user login. Basically, it should change Login to Hi, {{usr.username}} right after the login.

3条回答
  •  天命终不由人
    2021-01-15 21:13

    Call $scope.$apply();

    FirebaseRef.child("users").child(authData.uid).once('value', function(dataSnapshot) {
    
       $scope.$apply(function(){
          $scope.usr = dataSnapshot.val();
       });
    
    });
    

提交回复
热议问题