Skip to content

Instantly share code, notes, and snippets.

@erikzrekz
Created September 27, 2015 15:48
Show Gist options
  • Save erikzrekz/767ffc3114a274416c6d to your computer and use it in GitHub Desktop.
Save erikzrekz/767ffc3114a274416c6d to your computer and use it in GitHub Desktop.
app.factory('PollingService', function($http, $timeout) {
var data = { response: {} };
var poller = function() {
$http.get('data.json').then(function(r) {
data.response = r.data;
$timeout(poller, 1000);
});
};
poller();
return {
data: data
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment