-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Allow scope.$eval even while a $digest is in progress. #1618
Comments
There has been discussion about this before. The standard work around is On 28 November 2012 04:18, Jon Rosebaugh notifications@github.com wrote:
|
@petebacondarwin Couldn't a solution for this be to test to see if it's in a $digest in $eval, then set it to call in $timeout? Something like (psuedo code):
|
Actually, I think you need to rethink this issue. $eval is designed to be called from within $digest. Perhaps you mean calling $apply or $digest from within a $digest? |
Hm, I'm pretty sure I was having the error with $eval. I will attempt to isolate a plunker. |
I am integrating some jQuery functionality into my Angular app, which involves the use of jQuery callbacks. The docs indicate that callbacks executing outside of the context of a scope should use scope.$eval to make sure everything gets updated. This does indeed work. However, sometimes my callbacks are called immediately rather than later on, which means I get a "$digest already in progress" error.
I think I can work around this by wrapping all my callbacks in a setTimeout, but this seems inelegant. Perhaps there should be some way to let a callback which may or may not be executed outside a scope to wrap itself in the scope?
The text was updated successfully, but these errors were encountered: