This is a migrated thread and some comments may be shown as answers.

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

2 Answers 75 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Freddy
Top achievements
Rank 1
Freddy asked on 19 Feb 2016, 09:55 AM

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 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 24 Feb 2016, 09:48 AM
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!
 
0
Accepted
Genady Sergeev
Telerik team
answered on 01 Mar 2016, 09:17 AM
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!
 
Tags
Splitter
Asked by
Freddy
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Share this question
or