I'm using angularjs and particularly the $timeout service (a wrapper on setTimeout). It works as follows:
angular.module('MyApp').controller('MyController', ['$scope', '$timeout',
function($scope, $timeout) {
$scope.millisecondsLater = 3000000000;
$timeout(function(){
console.log('it\'s been ' + $scope.millisecondsLater + ' later');
}, $scope.millisecondsLater);
}
]);
when this controller is instantiated the function in the timeout gets called immediately. But if I set:
$scope.millisecondsLater = 2000000000;
it seemingly doesn't get called, as expected because this is (2000000 secs from now). And of coarse if I set $scope.millisecondsLater = 2000 the callback gets called 2 secs later.
It seems that $timeout has a maximum value somewhere between 3000000000 and 2000000000 and instead of never calling the callback it gets called immediately (for chrome at least). Has anyone run into this before? and how did you cleanly resolve it without a bunch of hard coded if < 2000000000 checks whenever timeouts are used?
Thanks in advance and any insight would be greatly appreciated!