Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When can I use $timeout(angular.noop)

Recently I purchased a code and after analyzing I found a strange code.
Here $timeout(angular.noop) was used something like refresh. I mean if I delete $timeout(angular.noop) ng-repeat list is not refreshed. I also tried to change $timeout(angular.noop) to angular.noop but not working. Is there anyone who knows exact functionality of $timeout(angular.noop)?

like image 690
artgb Avatar asked Feb 05 '26 10:02

artgb


1 Answers

Basically, that line evaluates changes between models and views and update UI and Model to be in sync.

As it's explained in more detail here

$timeout calls rootScope.$apply() which calls rootScope.$digest() but without the risk of getting digest is already in progress error.

like image 134
davcs86 Avatar answered Feb 07 '26 23:02

davcs86