Skip to content

Commit 930b399

Browse files
committed
updating with $timeout
1 parent 27321c0 commit 930b399

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

examples/angularjs-polling-timer.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<script src="../app/js/timer.js"></script>
77
<script>
88
angular.module('MyApp', ['timer']);
9-
function PollingController($scope) {
9+
function PollingController($scope, $timeout) {
1010
$scope.timerRunning = true;
1111
$scope.timerConsole = '';
1212

@@ -23,11 +23,13 @@
2323
};
2424

2525
$scope.$on('timer-tick', function (event, args) {
26-
$scope.timerConsole += $scope.timerType + ' - event.name = '+ event.name + ', timeoutId = ' + args.timeoutId + ', millis = ' + args.millis +'\n';
26+
$timeout(function (){
27+
$scope.timerConsole += $scope.timerType + ' - event.name = '+ event.name + ', timeoutId = ' + args.timeoutId + ', millis = ' + args.millis +'\n';
28+
});
2729
});
2830
}
2931

30-
PollingController.$inject = ['$scope'];
32+
PollingController.$inject = ['$scope', '$timeout'];
3133
</script>
3234
</head>
3335
<body ng-app="MyApp">

0 commit comments

Comments
 (0)