Skip to content

Commit 2c2484b

Browse files
committed
Using scope.$digest() rather than scope.$apply()
Following Andy Joslin's comment - I would use scope.$digest() on the directive's scope, which will only digest that specific scope, instead of $apply (which is global). https://groups.google.com/forum/#!topic/angular/KMaabQCggRA
1 parent 4a70954 commit 2c2484b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/js/timer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ angular.module('timer', [])
105105
//We are not using $timeout for a reason. Please read here - https://github.com/siddii/angular-timer/pull/5
106106
$scope.timeoutId = setTimeout(function () {
107107
tick();
108-
$scope.$apply();
108+
$scope.$digest();
109109
}, $scope.interval - adjustment);
110110

111111
$scope.$emit('timer-tick', {timeoutId: $scope.timeoutId, millis: $scope.millis});

0 commit comments

Comments
 (0)