Monaca Onsen UI Discord Chat Github Repo

how to cache page content !!

  • hi, i have some pages that need get some data from server by internet. i use pushPage and tried bringPageTop to navigate pages. all works well. but when i back or go to a page i will try to load contens from server again. i try to call function for getting content from internet in page init or show event but unfortunately contents get lost and need to load and request from server again and again when back to page.

    is there any way to cache content, because onsen only keep contents before ons.ready after that every contents added to pages will lost when page back or go to another pages.

    thank you for help and idea.

  • Onsen UI

    @meisam3322 Pages are destroyed when they are popped from the stack. Why don’t you just save your data outside the page? the init event can perform the request if there is no data available, get the data and store it. Every time after that you just use the saved data.