Clear the cache of a specific View


#1

Hello Ionicers,

Quick question: is this line supposed to work? $state.go(‘app.profile.posts’, {}, {cache:false});

Is specifying “{cache:false}” supposed to clean the cache of the view that I want ?
It does not work on my end, I am just asking to know if it is supposed to work for the current version 1.0 or 1.1

Hervé
Ionic forever


#2

I even tried:

$state.go(‘app.profile.posts’, {userId:userService.loggedUser.id}, {reload:true});

but it is still not working.

H


#3

Try setting cache to false in the state provider like:

.state('main_list', {
    cache: false,
    url: '/main_list',
    templateUrl: 'templates/pages/main_list.html',
    controller: 'MainListController'
 });

#4

Is there a way to clear the cache of a view when cache is set to true in the .state definition ?