GithubHelp home page GithubHelp logo

Safe $apply about angular-kendo HOT 10 CLOSED

kendo-labs avatar kendo-labs commented on August 26, 2024
Safe $apply

from angular-kendo.

Comments (10)

ospatil avatar ospatil commented on August 26, 2024

Yes, I too noticed it. Will add it soon.

from angular-kendo.

passelin avatar passelin commented on August 26, 2024

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.

from angular-kendo.

 avatar commented on August 26, 2024

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.

from angular-kendo.

passelin avatar passelin commented on August 26, 2024

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

from angular-kendo.

 avatar commented on August 26, 2024

Yes, I'll do it as soon as I get back into the office tomorrow. Thank you.

from angular-kendo.

treibholzhq avatar treibholzhq commented on August 26, 2024

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!

from angular-kendo.

marklagendijk avatar marklagendijk commented on August 26, 2024

An easier (and in my opinion, better) way is to use $timeout (without delay) in these cases:

$timeout(function(){
    // Do something
});

from angular-kendo.

burkeholland avatar burkeholland commented on August 26, 2024

@marklagendijk Didn't I see this in another issue? I can't find the number.

from angular-kendo.

marklagendijk avatar marklagendijk commented on August 26, 2024

@burkeholland I can't remember having seen this in an other angular-kendo issue, but I haven't read all of them :).

from angular-kendo.

burkeholland avatar burkeholland commented on August 26, 2024

Done and done.

from angular-kendo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.