Clear the cache depending on the view with $ ionicHistory.clearCache ()

2

is there a way to eliminate the cache of the view you want ?, for example in javascript I want to delete the cache of the next view I want, to actulize the information of all products, but in another view returns to the view products and at that moment I do not want to eliminate cache, just delete the cahce to click on a button, I tried to put $ ionicHistory.clearCache (), but it does not delete the cache, only if the cache-view="false is placed ":

<ion-view view-title="productos-view" cache-view="false">

Thank you very much.

    
asked by Albert Arias 09.12.2016 в 22:25
source

1 answer

3

Yes, this way:

 $state.go('app_location', {}, {location: 'replace'})

Where app_location should replace it with the name of your state so when you return with the button back it will not save the cache but refresh the view.

Another option is to use:

$scope.$on("$ionicView.beforeEnter", function(event, data){

})

This will make before you enter your sight execute code therefore you could refresh the information there.

    
answered by 09.12.2016 / 22:40
source