angular-carousel icon indicating copy to clipboard operation
angular-carousel copied to clipboard

Change scope.$apply to scope.$digest

Open rodrigolourenco opened this issue 8 years ago • 0 comments

Reading about $apply and $digest on angular communitty, i found that the use of these method's and the impact of launching them concurrently. For example, on my code/test's i launch digest to check the carousel change, but when i do this angular give me an error like this: "https://docs.angularjs.org/error/$rootScope/inprog?p0=$digest". So i change the code to trigger a $digest cycle, not a $apply after read this article "http://www.benlesh.com/2013/08/angularjs-watch-digest-and-apply-oh-my.html". In the case of the carousel, the $apply just have to change the carousel itself and not the entire view, because of this, than i change to $digest.

Simply put, it's a wrapper around $rootScope.$digest that evaluates any expression passed to it prior to calling $digest(). That's it. So, if you're calling it by itself without passing an argument to it, you may as well just call $digest().

Thank u ! Best regards from Brasil

rodrigolourenco avatar Apr 06 '16 18:04 rodrigolourenco