0

I need to refresh my app view every time I open the view Anyone know how to refresh the ionic view? The answer I found is using ion-refresher and cache view But ion-refresher just like to use for pull to refresh Do there got any other method to do this?

Tss
  • 88
  • 4
  • 13

3 Answers3

0

In the view's controller, you can listen to the $ionicView.enter or $ionicView.beforeEnter events to listen to when a view is entered.

$scope.$on( "$ionicView.enter", function(event) {
    $scope.refresh();
});
JimR
  • 2,145
  • 8
  • 28
  • 37
0

You can add an atribute in the HTML:

<ion-view cache-view="false" view-title="My Title!">
  ...
</ion-view>

Or, in your app.js:

$stateProvider.state('myState', {
   cache: false,
   url : '/myUrl',
   templateUrl : 'my-template.html'
})
Mati Tucci
  • 2,826
  • 5
  • 28
  • 40
0

with this line in your stard app can save time put cache-view="false" in all your views, so imagin you have in your projects 50 views and need to add this tag, a easiet an elegant way is use this line to your app do not stored the view and every time it get focus it refrefreshing automatically.

$ionicConfigProvider.views.maxCache(0);

Hope, it help you.

SAMUEL OSPINA
  • 321
  • 2
  • 9