Questions tagged [angularjs-digest]

Angular Digest Cycle

$digest

This is the “heartbeat” of an AngularJS application. $apply method processes all the watchExpressions nothing but $watchers for the current scope and its children. Then it checks for the current scope variables has been updated or not, if updated then call $digest and then scope binding gets updated.

196 questions
854
votes
28 answers

AngularJS : Prevent error $digest already in progress when calling $scope.$apply()

I'm finding that I need to update my page to my scope manually more and more since building an application in angular. The only way I know of to do this is to call $apply() from the scope of my controllers and directives. The problem with this is…
Lightbulb1
  • 12,674
  • 6
  • 19
  • 23
138
votes
12 answers

$apply already in progress error

Stack trace: Error: $apply already in progress at Error () at beginPhase (file:///android_asset/www/built.min.js:7:22740) at Object.Scope.$apply (file:///android_asset/www/built.min.js:7:25967) at…
Upvote
  • 65,847
  • 122
  • 353
  • 577
20
votes
1 answer

$apply already in progress when sending a click event to a button?

I have a button on my page with an id="viewQuestions" on a page: My code is checking for key hits like this: $scope.key = function ($event) { $scope.$broadcast('key', $event.keyCode) } and in…
Alan2
  • 19,668
  • 67
  • 204
  • 365
18
votes
3 answers

Infinite Digest Loop in AngularJS filter

I have written this custom filter for AngularJS, but when it runs, I get the infinite digest loop error. Why does this occur and how can I correct this? angular.module("app", []). filter('department', function(filterFilter) { return…
shmuli
  • 4,576
  • 3
  • 28
  • 58
18
votes
1 answer

"TypeError: Illegal invocation" when trying to upgrade from v1.2

Edit: It seems that this could be related to Chrome v43, I downgraded to v42 and everything works fine. Edit: I've submitted an issue on the Angular's Github repo. It seems that the error gets thrown by return logFn.apply(console, args); line 12221…
Ignas
  • 1,913
  • 2
  • 17
  • 40
13
votes
1 answer

What is regularInterceptedExpression in angular?

During debugging of my ng-app I've find out that most time of $digest takes regularInterceptedExpression. The question is, what is causes of triggering it?
Andrey Tsarenko
  • 535
  • 4
  • 16
12
votes
1 answer

AngularJS : How to edit $scope from the console?

I am able to access the $scope variable per the accepted answer here. However, I am not able to edit it from the console, i.e. change properties, call functions etc. Is this even possible? Here is a test code I've been experimenting with:
miniml
  • 1,409
  • 2
  • 13
  • 27
10
votes
1 answer

Angular : Update model from directive

I have a fiddle up here: http://jsfiddle.net/KdkKE/44/ What I'd like to do create a 'toggle' component, basically a custom checkbox but with html that changes if it is true or false, which is bound to a boolean in a controller. When the user clicks…
6
votes
1 answer

The Url of dialog box does not work with angular.bootstrap (infinite $digest Loop)

I have a mean-stack website. I want to use ExecuteFunction to bind a button to launch this website in a Dialog box: function doSomethingAndShowDialog(event) { clickEvent = event; …
SoftTimur
  • 8,904
  • 23
  • 106
  • 212
6
votes
1 answer

In what order do angular watchers and event listeners execute?

If one changes a scope property first, and then broadcasts an event second, will the corresponding watcher callback and event listeners callback always be executed in that same order? For example: $scope.foo = 3; $scope.$broadcast('bar'); and…
tom
  • 1,869
  • 1
  • 14
  • 25
6
votes
1 answer

$digest already in progress when calling $rootScope.$apply() in quick succession

So I have an AngularJS service listening for some events. On the handling of these events I need to call different controllers and ultimately load a new view. In one event handler I am using $location.path() then calling $rootScope.apply() to…
user1491636
  • 2,057
  • 6
  • 34
  • 67
6
votes
2 answers

Angular: why isn't $evalAsync called $applyAsync?

Angular beginner question about scopes (docs here). $eval executes an expression in the context of a scope. $apply basically calls $eval and then $digest. Why does $evalAsync call $digest too (or, more precisely, ensure $digest is called)? It…
Evan Hahn
  • 10,035
  • 7
  • 33
  • 43
5
votes
2 answers

ondragstart, ondragover,onstart - $scope is not defined

My task is to process the dropped text using angular. I keep getting this error $scope is not defined on drag and drop events. Any idea how to fix this? I already looked into angular drag and drop libraries. They don't allow drag and drop for…
5
votes
1 answer

How to check if the digest cycles have stabilized (aka "Has angular finished compilation?")

tl;dr: The initial question was "How to trigger a callback every digest cycle?" but the underlying question is much more interesting and since this answers both, I went ahead and modified the title. =) Context: I'm trying to control when angular has…
Phil Thomas
  • 1,207
  • 1
  • 12
  • 32
4
votes
0 answers

Angular UpgradeModule $rootScope.$digest error, even though we are not triggering a digest manually

We have a super weird login bug that appears to be caused by this line in Angular's UpgradeModule, so I have a question about that line. why is: var subscription = _this.ngZone.onMicrotaskEmpty.subscribe(function () { return $rootScope.$digest();…
Andrew Luhring
  • 1,553
  • 1
  • 15
  • 34
1
2 3
13 14