JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="myApp" ng-controller="Ctrl">
<span>Time (in ms): {{timeInMs}}</span>
<br></br>
<span>Time (in ms): {{timeInMs_old}}</span>
</div>
JavaScript
angular.module('myApp', []);
function Ctrl($scope, $timeout) {
$scope.timeInMs = 0;
var countUp = function() {
$scope.timeInMs+= 500;
$timeout(countUp, 500);
}
$timeout(countUp, 500);
$scope.timeInMs_old = 0;
var countUp_old = function() {
$scope.timeInMs_old+= 500;
setTimeout(function () {
$scope.$apply(countUp_old);
}, 500);
}
setTimeout(function () {
$scope.$apply(countUp_old);
}, 500);
}