$ interval doesn't work, angularjs
I'm not sure why this code isn't working. I am trying to set up a simple counter that increments every second using an angular $ spacing wrapper.
angular.module('app').controller('testController', function($scope, $interval){
var set_counter = function(){
var start_time = new Date(2014, 09, 02, 0,0,0,0).getTime()
var time_counter = new Date().getTime()
$scope.counter = Math.ceil(time_counter / 1000000 + ((time_counter / 1000 - start_time / 1000) * 0.5)).toLocaleString();
console.log($scope.counter);
}
$interval(set_counter(), 1000);
});
+3
source to share