Clear cache of one view?

Hi,
is it possible to clear cache just for one view ?
I dont want to use cache-view=“false”, because i want to cache this view, but there are exceptions when i want to clear that cache.

For example, i have one view with list data, which i use to show search results.
The thing is, i have multiple search views and one view to show this results.
And when i change state from one search view to another and press “Search”, i get previous cached view with search results. If i set cache-view:false, then if i go back from some state to this result view, this large list will be loaded again, and i dont want that, because all data is gathered from server.
I just want to do, is when i enter the search view to clear previous cached result view(just one, not all with $ionicHistory.clearCache()).

Maybe just disable the cache for this view ?

With cache param set to false in the router config :

.state('app.search', {
  url: "/search",
  cache: false,
  views: {
    'menuContent': {
      templateUrl: "templates/search.html",
      controller: 'SearchCtrl'
    }
  }
})

older topic

Hi tomadj.
Thanks a lot, but i’ve tried this and it completely disables cache from this view. And that is not what i am trying to do.
The thing is, this view is populated with large scrollable list of some “Items”, and when i click on some “Item” it shows “Item details”. And with cache:false, if i go back to “Item list”, this large list is being populated again, and scroll position is completely lost. I want some solution where i can clear cache manually for this view, not to disable cache completely. One of the solutions is to $ionicHistory.clearCache(), but that will clear cache for all views, and this still isn’t a good option.

1 Like

Maybe I don’t understand but, in this case where you want clear the cache, why you don’t just clear the collection of item from the scope ?