title: Ionic / How to expect a cached view to be refreshed?
body: <p>I'm using the latest Ionic "nighty build" version currently. </p>
  
  <p>One good news with this version is the concept of <a href="http://ionicframework.com/docs/nightly/api/directive/ionNavView/" rel="noreferrer">cached views</a>:</p>
  
  <blockquote>
    <p>By default views are cached to improve performance. When a view is
    navigated away from, its element is left in the DOM, and its scope is
    disconnected from the cycle. When navigating to a view which is
    already cached, its scope is then 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.</p>
  </blockquote>
  
  <p>Interesting, so I tried it and it's really smooth.</p>
  
  <p><strong>However, I come across a severe UX issue</strong>:</p>
  
  <p>Basically, my app is composed of 2 <a href="http://ionicframework.com/docs/nightly/api/directive/ionTabs/" rel="noreferrer">tabs</a>.       </p>
  
  <ul>
  <li>TabA aims to display a load and list items.</li>
  <li>TabB aims to display other items.</li>
  </ul>
  
  <p>Each one has its own navigation:  listing and showing specific items.<br>
  Obviously, the first time, data are fresh, but then, since cached => stale. </p>
  
  <p>Cached views is really adapted to the "back" button from the "show" to the "list" of a specific tab.<br>
  Indeed, scroll is maintain and controllers don't need to reload => very good performance. </p>
  
  <p>However, what a user wants when he clicks on a particular tab is to get a refreshed list.      </p>
  
  <p>I really can't find a pretty and efficient way to refresh a specific cached view regarding the clicked element.</p>
  
  <p>I've got those declared <strong>states</strong> (showing the example for TabA): </p>
  
  <pre><code>        .state('tab', {
              url: "/tab",
              abstract: true,
              templateUrl: "/tabs.tpl.html",
              controller: 'TabsCtrl'
          })
  
          .state('tab.tabAList', {
              url: '/items',
              views: {
                  'tab-a': {
                      templateUrl: '/tabAList.tpl.html',
                      controller: 'TabACtrl'
                  }
              }
          })
  
          .state('tab.tabAShow', {
              url: '/tabAList/:itemId',
              views: {
                  'tab-a': {
                      templateUrl: '/tabAShow.tpl.html',
                      controller: 'TabAShowCtrl'
                  }
              }
          });
  </code></pre>
  
  <p>So, <code>tab</code>'s controller is the parent of <code>tab.tabAList</code> and <code>tab.tabAShow</code>. </p>
  
  <p><code>tabList</code> contains a function like:  </p>
  
  <pre><code>$scope.reloadItems = function() {
      //...
  }
  </code></pre>
  
  <p>How to trigger this function when <code>tabA</code> is clicked?<br>
  The tricky part is that <code>TabsCtrl</code> code is run just before nested <code>TabAList</code> controller is run.<br>
  I tried to involve a <code>$rootScope.$broadcast('reloadTheItems',...)</code> under the <code>on-select</code> attribute of the tab.<br>
  But the event is missed since <code>tabAList</code> hasn't run yet at the time of the event sending.</p>
  
  <p>Has anyone experienced it and has a pretty solution?
  I repeat, the goal is:  "<strong>Reload a specific cached view on tab click</strong>".</p>