using setInterval in angularjs factory
问题 I was trying the code given in angularjs docs (given here: http://jsfiddle.net/zGqB8/) It just implements a time factory and uses $timeout to update the time object after each second. angular.module(\'timeApp\', []) .factory(\'time\', function($timeout) { var time = {}; (function tick () { time.now = new Date().toString(); $timeout(tick, 1000); // how to do it using setInterval() ? })(); return time; }); How would I do it using setInterval() function instead of $timeout() ? I know that one