directive scope will not be destroy when call the remove method of splitter

3 posts, 1 answers
  1. Freddy
    Freddy avatar
    9 posts
    Member since:
    Aug 2015

    Posted 19 Feb Link to this post

    hello there,

     

    I encounter a issue that, i have a directive in a pane of splitter, of course i can remove it and re-append it to the splitter. for now, the directive has a isolate scope, even though i had remove the current pane from the document, but the isolate scope is still there, is it makes the memory leak? because this operation maybe will be execute a lot time in a short time. so there will be a lot of scope objects in memory.

    here is the demo in dojo

  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 24 Feb Link to this post

    Hi Freddy,

    It is not recommended (some people even consider it bad practice) to remove directives with jQuery (or pure DOM operations) as this will surely lead to memory leaks.

    It is best to remove elements using the angular way, for example ng-if. In case you really need to remove a directive with jQuery please consider calling manually $destroy on the scope.

    In the specific case if your example though, ng-if seems to break splitter, whereas explicit $destroy leads to  JavaScript errors (please take a look at the sample). We will probably need to take deeper look in code. I will update the thread when we have resolution.

    Regards,
    Genady Sergeev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Answer
    Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 01 Mar Link to this post

    Hello Freddy,

    Unfortunately at the moment there seems to be no way to remove panes and achieve 100% destroy on child scopes of removed panes. This is both a limitation of the splitter(which was not designed to be used in Angular environments) and quirks in the very angular framework. We will do our best to resolve the problem in the upcoming release.

    Regards,
    Genady Sergeev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top