title: angularjs Watching rootscope changes
body: <p>I'm trying to bind to rootscope so that I can set presence on a different server when the user logins.
  Here's my module.</p>
  
  <pre><code>angular.module('presence', 
    [
    ]
  )
  
  .run(function ($rootScope) {
    $rootScope.$watch($rootScope.currentUser, function () {
      console.log('change currentUser')
      console.log($rootScope.currentUser)
      presence.setGlobal({
        u: $rootScope.currentUser,
        s: 'on'
      })
    })
  })
  </code></pre>
  
  <p>There's no controller because it's just about the global presence of the user and has nothing to do with the DOM.</p>
  
  <p>This is not working, the watch runs once but never again on subsequent changes. Thanks for your help.</p>
  
  <p>Edit: Login code looks like this:</p>
  
  <pre><code>  $scope.login = function() {
      $http.post('http://localhost:3000/login', $scope.user).success(function(res, status) {
        if (res &amp;&amp; res._id) {
          $rootScope.currentUser = res
        }
      }).error(function(res, status) {
        $scope.error = res.err
      });
    };
  </code></pre>
  
  <p>This code updates fine in the DOM. It shows the username in the html for example:</p>
  
  <pre><code>a.user(ui-if="currentUser", ng-href="/user/{{currentUser._id}}") {{currentUser.username}}
  </code></pre>