$state.go isn't refreshing my view

Just some information on cached views:

  • Cached Views:
  • Previously, as a user navigated an app, each exiting view’s element and scope would be destroyed. If the same view was accessed again then the app would have to recreate the element. Views can now be cached to improve performance.
  • Now, when a view is exited, its elements are left in the DOM, and its scope is disconnected from the cycle. When navigating to a view which is already cached, its scope is reconnected, and the existing element which was left in the DOM becomes the active view.
  • This also allows for scroll position of previous views to be maintained (without skippy jumps).
  • Config variables can be used to disable view caching, IE set to 0, or change the maximum number of views to cache.
  • Individual ionViews can disable caching by using the cache-view=“false” attribute, or from its $stateProvider.state config.
  • Note: Views with many large images or videos should not be cached.
  • The ionNavView docs have more further documentation.

If you don’t want to disable caching, but want specific code to be called each time a view is entered, you can use this in your controller:

$scope.$on('$ionicView.enter', function() {
    // code to run each time view is entered
});
9 Likes