title: Auto-updating scope variables in angularjs
body: <p>I'm currently playing with AngularJS. I'd like to return, from a service, a variable that will let the scope know when it has changed.</p>
  
  <p>To illustrate this, have a look at the example from www.angularjs.org, "Wire up a backend". Roughly, we can see the following:</p>
  
  <pre><code>var projects = $firebase(new Firebase("http://projects.firebase.io"));
  $scope.projects = projects;
  </code></pre>
  
  <p>After this, all updates made to the <code>projects</code> object (through updates, be it locally or remotely) will be automatically reflected on the view that the scope is bound to.</p>
  
  <p>How can I achieve the same in my project? In my case, I want to return a "self-updating" variable from a service.</p>
  
  <pre><code>var inbox = inboxService.inboxForUser("fred");
  $scope.inbox = inbox;
  </code></pre>
  
  <p>What mechanisms let the <code>$scope</code> know that it should update?</p>
  
  <p><strong>EDIT:</strong> 
  In response to the suggestions, I tried a basic example. My controller:</p>
  
  <pre><code>$scope.auto = {
      value: 0
  };
  
  setInterval(function () {
      $scope.auto.value += 1;
      console.log($scope.auto.value);
  }, 1000);
  </code></pre>
  
  <p>And, somewhere in my view:</p>
  
  <pre><code>&lt;span&gt;{{auto.value}}&lt;/span&gt;
  </code></pre>
  
  <p>Still, it only displays 0. What am I doing wrong ?</p>