I am sure it is a simple problem, but since I work in angular for like 2 weeks now I can't seem to figure it out.
I have this facebook login with firebase function:
function FBLogin(){
var provider = new firebase.auth.FacebookAuthProvider();
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Facebook Access Token. You can use it to access
the Facebook API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
console.log(user.displayName);
$scope.user = user.displayName;
$scope.loggedIn = true;
// ...
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
console.log(error);
// ...
});
}
$scope.user should show me the username in the HTML when the promise is returned right? It doesn't do that.
HTML:
The button for calling the function:
<a ui-sref=".dashboard" class="btn btn-primary">
<img class="logo-image" src='components/images/login-button-png-
18039.png' width="140" height="50" ng-click="vm.FBLogin()" ng-
if="!loggedIn">
</a>
The field where the data should be displayed:
<p ng-if="loggedIn">{{ user }} xxx</p>
The username is shown in the console, but not in HTML.