title: Controller value not updating after async factory call (FB API)
body: <p>I'm building a custom AngularJS factory that deals with Facebook user authentication.</p>
  
  <p>In my controller I am binding to the <code>FBUser</code> object but my view is not outputting anything for <code>{{user.name}}</code>. However, if I wrap the controller block in a 1 second <code>$timeout</code> then it works. I thought <code>$rootScope.$apply()</code> would trigger my view to update with the new FBUser values but it doesn't. Ideally I want to do as little work within the controller as possible because in future I want other model controllers in my app to make use of the user object from the factory.</p>
  
  <pre><code>angular.module('tatsdb.fbauth', ['tatsdb.api'])
  
  .factory('FBAuth', ['$rootScope', function($rootScope) {
    var FBUser = {};
    var FBAuth = {};
  
    FBAuth.authResponseChange = function() {
      FB.Event.subscribe('auth.authResponseChange', function(response) {
        if (response.status === 'connected') {
          FBAuth.getUserAsync();
        }
        else {
          console.log('not connected');
        }
      });
    };
  
    FBAuth.getUserAsync = function() {
      FB.api('/me', function(response) {
        console.log('Good to see you, ' + response.name + '.');
        $rootScope.$apply(function() {
          FBUser = response;
        });
      });
    };
  
    FBAuth.getUser = function() {
      return FBUser;
    };
  
    FBAuth.logout = function() {
      FB.logout(function(response) {
        FBUser = {};
      });
    };
  
    return FBAuth;
  }])
  
  .run(['$window', 'FBAuth',
    function($window, FBAuth) {
      $window.fbAsyncInit = function() {
        FB.init({
          appId      : '278156419011935',
          status     : true, // check login status
          cookie     : true, // enable cookies to allow the server to access the session
          xfbml      : true  // parse XFBML
        });
  
        FBAuth.authResponseChange();
      };
  
      // Load the SDK asynchronously
      (function(d){
       var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
       if (d.getElementById(id)) {return;}
       js = d.createElement('script'); js.id = id; js.async = true;
       js.src = "//connect.facebook.net/en_US/all.js";
       ref.parentNode.insertBefore(js, ref);
      }(document));
  }])
  
  .controller('FBUserController', ['$scope', 'FBAuth', function($scope, FBAuth) {
    $scope.user = FBAuth.getUser();
  }]);
  </code></pre>