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

Need guidance on how Views are destroyed

3 Answers 28 Views
View
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 17 Jul 2015, 04:14 PM

I noticed that template-based Views are not destroyed as Router is navigating through them - they are simply taken out of the DOM. Sometimes this might be desired behavior, but not always. What is the recommended approach for destroying views, when Router is navigation out of them? This also would require complete disconnect from any subscriptions to ViewModel if they are kept in memory.

 Thanks,

 Sam

3 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 20 Jul 2015, 06:34 AM
Hello,

you can use the destroy method for that.

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Sam
Top achievements
Rank 1
answered on 20 Jul 2015, 03:24 PM
This means I have to keep track of them manually and also catch the navigation back. Is there any provision to instruct Router do that? Otherwise these pages will simply accumulate in memory.
0
Accepted
Petyo
Telerik team
answered on 21 Jul 2015, 07:52 AM
Hi,

the router and the view components are not coupled - there is no automatic view instance management. If you are looking for such sort of SPA feature, then you may consider a "higher level" SPA toolkit, like AngularJS. 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
View
Asked by
Sam
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Sam
Top achievements
Rank 1
Share this question
or