I am playing with AngularJS now. I would like to return a variable from the service that will let the region know when it changed.
To illustrate this, take a look at the example from the website www.angularjs.org "Connect the backend." Roughly, we can see the following:
var projects = $firebase(new Firebase("http://projects.firebase.io"));
$scope.projects = projects;
After that, all updates made to the object projects(through updates, whether locally or remotely) will be automatically reflected in the view to which the area is attached.
How can I achieve the same in my project? In my case, I want to return the "self-update" variable from the service.
var inbox = inboxService.inboxForUser("fred");
$scope.inbox = inbox;
What mechanisms let $scopeknow that it should be updated?
EDIT:
. :
$scope.auto = {
value: 0
};
setInterval(function () {
$scope.auto.value += 1;
console.log($scope.auto.value);
}, 1000);
- :
<span>{{auto.value}}</span>
, 0. ?