Hi All,
I want to achieve something like this,
There a list screen. By clicking on a list item it navigates to details screen. By clicking a button in details1 screen another screen (details2) is opened.
I want to disable caching (force refresh the view) when navigating forward and show cached view when navigating back.
If I set cache:false for “detail1” state in app.js detail1 screen is reloaded even when going back from detail2 screen to detail1.
If I set cache:true for “detail1” state in app.js detail1 screen does not reload every-time navigate from list screen to detail1 screen.
How can I remove cached detail1 screen when going back to list screen from detail1 screen?
OR
How can I force reload detail1 screen everytime I go to detail1 screen from list screen?
Please HELP ME.
Thanks in advance.
According to ionic documents http://ionicframework.com/docs/api/directive/ionNavView/#Caching
"By default, when navigating back in the history, the “forward” views are removed from the cache. If you navigate forward to the same view again, it’ll create a new DOM element and controller instance. Basically, any forward views are reset each time. This can be configured using the $ionicConfigProvider:
$ionicConfigProvider.views.forwardCache(true);"
So I added $ionicConfigProvider.views.forwardCache(false);
But still having this issue.
I inspected the dom after setting above config. Result is
Why views are cached even I navigated back from them?
To elaborate more,
I have to ion-nav-views. One for tabs and other as main container. I need to removed the cached view. Detail1 screen never gets removed when going back and 10 instances of the detail1 screen is cached.
Going back to details1 screen from details2 screen works as expected (details2 view is removed when going back)