Source Code:
(back to article)
Submit
Result:
Report an issue
angular.module('myModule') .service('DataManager', function($interval, $http, Person, $rootScope) { $interval(function(){ $http.get([url]) .then(function(data){ Person.setName(data.name); Person.setListCount(data.count); // here we have to send signal that we have a new live data from the server // we use Root Scope, because we don't know what scope architecture do we have $rootScope.$broadcast("newPersonData"); }); // getting the data every 1 minute }, 60000); })