Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$interval's invokeApply parameter does not change anything

From the angular's documentation of $interval service:

invokeApply (optional) boolean: If set to false skips model dirty checking, otherwise will invoke fn within the $apply block.

Which can lead us to a conclusion that $rootScope.$apply wouldn't be called if I set invokeApply as false.

However, from the source of $interval I learned that deferred.notify is called each tick, which makes sense. What does not, is the fact that during deferred.notify execution $rootScope.$evalAsync is called, which in order calls $rootScope.$digest. So all the dirty checking still happens. Am I missing something here?

like image 758
Vasaka Avatar asked Apr 21 '14 15:04

Vasaka


People also ask

What is the use of setInterval method?

The setInterval() method calls a function or evaluates an expression at specified intervals (in milliseconds). The setInterval() method will continue calling the function until clearInterval() is called, or the window is closed. The ID value returned by setInterval() is used as the parameter for the clearInterval() method.

What is the return value of an interval function?

The return value of registering an interval function is a promise. This promise will be notified upon each tick of the interval, and will be resolved after count iterations, or run indefinitely if count is not defined. The value of the notification will be the number of iterations that have run.

How do I cancel an interval in a test?

To cancel an interval, call $interval.cancel(promise). In tests you can use $interval.flush(millis) to move forward by millis milliseconds and trigger any functions scheduled to run in that time. Note : Intervals created by this service must be explicitly destroyed when you are finished with them.

What is setInterval in Python?

Definition and Usage. The setInterval() method calls a function or evaluates an expression at specified intervals (in milliseconds).


1 Answers

Bug already filed!

https://github.com/angular/angular.js/pull/5903

You are missing nothing

like image 178
DrogoNevets Avatar answered Oct 19 '22 21:10

DrogoNevets