Need guidance on how Views are destroyed

4 posts, 1 answers
  1. Sam
    Sam avatar
    5 posts
    Member since:
    Oct 2014

    Posted 17 Jul 2015 Link to this post

    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

  2. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 20 Jul 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Sam
    Sam avatar
    5 posts
    Member since:
    Oct 2014

    Posted 20 Jul 2015 in reply to Petyo Link to this post

    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.
  5. Answer
    Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 21 Jul 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready