Question on caching and navigation

I’m having a hard time understanding the value/purpose behind the caching feature in ion-nav-view? One of the nice things about Angular was that controllers are stateless by default. Services can hold state but every time you navigate to a new view the controller would bootstrap itself again – which guarantees the view state would be fresh.

With Ionic’s cache feature, this seems to be more of a headache than a blessing. I understand that you can disable the cache, but I guess I’m wondering what the purpose is behind it?

Controller logic is typically pretty quick and templates are cached, so why would I want to navigate back to a view which doesn’t re-fresh itself if the state changed somewhere else?

Consider a simple example – it may very well be I have something mis-configured or I’m doing it wrong, here’s a codepen based on simple tabs + navigation

  1. On Home screen see “Things” object is dumped to JSON
  2. Navigate to Scientific Facts, see “Things” is also dumped to JSON; wait one second and see it update to a new value due to $timeout which runs angular digest cycle.
  3. Use back button to navigate back and the view is stale. “Things” still has the old value because HomeCtrl only ran once and will not run again.

In order to refresh the view on that controller, it seems one has to do this (this code is in the codepen, comment it in to see it work):

  $scope.$on('$ionicView.enter', function () {
    $scope.things = Things.get();

Alternatively, one could use angular’s $scope.$watch.

This just seems wrong when Angular does this by default out of the box? What is the value in dead controllers that only run once when navigated to?

I’m assuming the original thought process behind it was for a performance optimization?

But if I now have to write code to refresh every view’s data it seems ill-advised so the better option is to disable caching altogether. Am I missing something here?