Google News
logo
Ionic - Interview Questions
What is the advantage of caching the views in Ionic apps? Provide examples.
Ionic by default caches up to ten views, which improves performance and also maintains different states in the views at the same time. For example, the cache can maintain scroll position in the views or active state of buttons.
 
Caching can be disabled per view by using cache: false in UI-router’s state config, like in the following example :
$stateProvider.state('myState', {
   cache: false,
   url : '/myUrl',
   templateUrl : 'my-template.html'
})
Caching can be also disabled globally, by setting maxCache to 0 :
$ionicConfigProvider.views.maxCache(0);
Advertisement