title: AngularJS / Ionic routing using $stateProvider - controller is not reloading the second time a state is called
body: <h2>Original Question</h2>
  
  <p>I'm developing a mobile app using the Ionic Framework and AngularJS and I am having issues with controllers not reloading once they have been initialised. </p>
  
  <p>One of the state transitions (from <code>'app.postbox-details'</code> to <code>'app.audit-questions'</code>) should pass a parameter to the <code>'app.audit-questions'</code> controller but this controller does not update itself with the new parameter because it isn't reloading. </p>
  
  <p>Code Example</p>
  
  <p><em>app.js file - config</em> </p>
  
  <pre><code>angular.module('sf-maintenance', ['ionic', 'starter.controllers', 'starter.services', 'ngCordova'])           
  .config(function ($stateProvider, $urlRouterProvider, $httpProvider) {
      $stateProvider
         .state('home', {
             url: '/home',
             templateUrl: 'templates/home.html',
             controller: 'HomeCtrl',
         })
         .state('app', { //app state being the side-menu
             url: '/app',
             abstract: true, //means that this state will never be activated directly, users will always go to a child state instead.
             templateUrl: 'templates/side-menu.html',
             controller: 'MenuCtrl'
         })       
         .state('app.postbox-details', {
             url: '/postbox-details',
             views: {
                 'menuContent': {
                     templateUrl: 'templates/postbox-details.html',
                     controller: 'PostboxDetailsCtrl'
                 }
             }
         })
      .state('app.audit-questions', {
          url: '/audit-questions/:postboxGuid',
          views: {
              'menuContent': {
                  templateUrl: 'templates/audit-questions.html',
                  controller: 'AuditCtrl'
              }
          }
      })
      $urlRouterProvider.otherwise('/home');
  });
  </code></pre>
  
  <p><em>controller.js file (left out the code that isn't relevant)</em></p>
  
  <pre><code>angular.module('starter.controllers', [])    
  .controller('HomeCtrl', function ($scope) {
  })    
  .controller('MenuCtrl', function ($scope) {
  })    
  .controller('PostboxDetailsCtrl', function ($scope, $ionicLoading, $ionicPopup, $cordovaBarcodeScanner, $state, DataService) {
  
      $scope.postboxGuid = DataService.getNewGUID();
      //Rest of the controller functions are below
  })    
  .controller('AuditCtrl', function ($scope, $ionicSlideBoxDelegate, $stateParams, DataService) {
  
      $scope.auditDetails = {
          postboxGuid: $stateParams.postboxGuid
      };    
  });
  </code></pre>
  
  <p><em>View - navigation code</em></p>
  
  <p>The view code to perform the navigations all use <code>&lt;a&gt;</code> tags:</p>
  
  <ul>
  <li>From the home view to the postbox-details view: <code>&lt;a class="button button-block button-dark icon-right ion-chevron-right" href="#/app/postbox-details"&gt;New inspection&lt;/a&gt;</code></li>
  <li>From the postbox-details view to audit-questions view: <code>&lt;a class="button button-block button-dark icon-right ion-chevron-right" ng-click="saveFormData()"
         ng-href="#/app/audit-questions/{{postboxGuid}}"&gt;New audit&lt;/a&gt;</code></li>
  </ul>
  
  <p>So does anybody know how to get controllers to reload once it has been initialised or if I am going about this problem the wrong way could you guide me to a method that will work?</p>
  
  <hr>
  
  <h2>Updated Information</h2>
  
  <p>I recently saw a <a href="https://stackoverflow.com/questions/36896079/reload-true-works-only-once">related question</a> and the response by @Radim Köhler pointed to the answer in <a href="https://stackoverflow.com/questions/30991990/ui-router-not-reloading-controller">this question</a> which provides good information on why it may not be a good idea to use <code>cache:false</code> on a view because of performance. </p>
  
  <p>I thought I would share this because in some situations you may benefit more performance-wise by using one of <a href="http://ionicframework.com/docs/api/directive/ionView/" rel="nofollow noreferrer">Ionic's built-in view life cycle events</a>  to run code without having to disable the view from being cached.</p>