I am trying to implement a simple timer in angularJS. But timeout function is not working though it is suggested by everyone.
You have to inject the $timeout
service to the controller
var myApp = angular.module("ss", []);
myApp.controller('mainCtrl', function ($sce, $scope, $timeout) {
$scope.timeInMs = 10;
var countUp = function () {
$scope.timeInMs += 500;
$timeout(countUp, 500);
}
$timeout(countUp, 500);
});
{{timeInMs}}