-
Notifications
You must be signed in to change notification settings - Fork 209
Safe $apply #27
Comments
Yes, I too noticed it. Will add it soon. |
I have not used this trick here as I don't think it is necessary: the event handlers will always be invoked asynchronously by the kendo ui code. Have you come across a case where 2 event handlers were invoked synchronously by the kendo ui code? Until such a case is reported, I don't think we need to change this. |
Well, I'm using a Kendo Grid with server paging/sorting/filtering, and I'm using k-on-change and k-on-data-bound to bind the selected row to the scope and retain the selection on page change. It's happening somewhere in there, as my console shows a '$digest() already in progess' error. If I do a safe $apply() everything is fine. |
Thanks, we'll look into this. Can you share a fiddle or plunker? You can start from here if you want: http://plnkr.co/edit/F3IFhf |
Yes, I'll do it as soon as I get back into the office tomorrow. Thank you. |
Hi, here's the plunk: http://plnkr.co/edit/sUJUbU I was a bit confused about the angular-kendo.js you used in your starting point posted above. It has 400+ lines of code, while the one I am using (https://github.com/kendo-labs/angular-kendo/blob/master/build/angular-kendo.js) only has 253 LoC. Anyway, please run my plunk in embedded view, select a row on first page, then switch to second page, then back to first again and you will find the row reselected. While doing this, please watch the console as it will give you an "Error: $apply already in progress" message. Thanks! |
An easier (and in my opinion, better) way is to use $timeout (without delay) in these cases: $timeout(function(){
// Do something
}); |
Changing the tagline Add bower.json file Specify main in bower.json Remove dependency on jQuery Update CHANGELOG Corrected module name - from kendo to kendo.directives Update widget.js Currently the minified version (build/angular-kendo.min.js) is broken, because the 'minify-proof-dependency-injection-syntax' was forgotten here. This pull requests fixes that issue. Added missing packages Changed to safe for #27 Added safe apply for #27 Preparing for 0.5.1 release
@marklagendijk Didn't I see this in another issue? I can't find the number. |
@burkeholland I can't remember having seen this in an other angular-kendo issue, but I haven't read all of them :). |
Done and done. |
Hi,
just wanted to mention that you should do a safe $apply() in line 95 and 195 respectively.
That is to prevent running $apply() when there is already one running.
You should do it this way: https://coderwall.com/p/ngisma
The text was updated successfully, but these errors were encountered: