Skip to content

Instantly share code, notes, and snippets.

@jjvdangelo
Created March 21, 2014 21:48
Show Gist options
  • Save jjvdangelo/9697187 to your computer and use it in GitHub Desktop.
Save jjvdangelo/9697187 to your computer and use it in GitHub Desktop.
Trying to figure out why three $http.gets are fired at a time with this controller.
mod.controller("MyController",
[
"$scope", "$http",
($scope: any, $http: ng.IHttpService) => {
var queueChecker = setInterval(() => {
var url = "/foo/count";
$http.get(url, { params: { cacheBuster: new Date().getMilliseconds() } })
.success((data: any) => {
$scope.QueueView = data;
$scope.QueueView.lastUpdated = new Date();
});
}, 2500);
$scope.$on("$destroy", () => { clearInterval(queueChecker); });
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment