This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
$interval invokes $rootScope.$digest()
regardless of invokeApply
param #7103
Closed
Description
$interval()
uses a $q deferred to notify its callback function each tick and the $QProvider
wraps all callbacks in $rootScope.$evalAsync
which executes them inside the next $digest loop.
This means that the final line of $interval
has no useful effect:
if (!skipApply) $rootScope.$apply();
and the invokeApply
param is very misleading since regardless of what value it holds $interval will cause a full $rootScope.$digest()
with every invocation.
It might be better to have $interval
and $timeout
functions available on a $scope
instance so that a) they get cleaned up when the scope is destroyed, b) they only cause their $scope
instance to be dirty checked.