Joined August 2012
·

Alex Vanston

Denver, CO
·
·
·

Posted to 'Safe' $apply in Angular.JS over 1 year ago

@marklagendijk That will likely work the vast majority of the time, though, in my experience, if you're responding to tons of events (such as a video feed), it still has the potential to result in multiple digests/applies.

More importantly, it results in your code being called after the current process thread. For many situations that may be preferable (particularly when doing DOM binding, such as with a jQuery plugin), but if you intend to immediately use any of the variables you just worked on, it will cause problems.

Posted to 'Safe' $apply in Angular.JS over 1 year ago

@digger69 I have considered it and have been looking through repository to see where it would best fit. I'll update this thread once I submit a pull request.

Posted to 'Safe' $apply in Angular.JS over 1 year ago

@roypeled Thanks for the note, I hadn't realized apply could be called without a parameter. I've updated by original code to take that into account.

Achievements
1,682 Karma
142,038 Total ProTip Views