JSFiddle - React, Tailwind, and code Playground
HTML
<div class="count" ng-app="timerApp" ng-controller="CountdownController">
<h1 ng-show="count < 10">{{count}}</h1>
</div>
JavaScript
var timerApp = angular.module('timerApp', []);
timerApp.controller('CountdownController', ['$scope', '$timeout',
function($scope, $timeout) {
$scope.count = 0;
/*$scope.increment = function() {
console.log($scope.count);
$scope.count++;
};*/
/*$scope.increment = function() {
$scope.$apply(function() {
$scope.count++;
});
};
setInterval($scope.increment, 1000);*/
$scope.increment = function() {
$scope.count++;
if ($scope.count < 10) {
$timeout($scope.increment, 1000);
}
};
$scope.increment();
}
]);