luiscarlosjayk/angular-facebook

$scope update fails

SteveRepp opened this issue · 0 comments

When trying to assign an API /me call response to a $scope variable on a Chrome OSX Browser, the assignment works only until exiting the API call. Code shown below:

$scope.FacebookUserSetup = function() {
if ($scope.facebookAuth.isConnected) {
Facebook.api('/me', function(response) {
console.log(response);
$scope.$apply(function() {
$scope.user = response;
console.log($scope.user); //Works up to here... and matches response
});
});
}
console.log($scope.user); // empty or set to whatever the controller's default is...
};