Nav back button not reloading view


#1

Hi all, I am having some trouble navigating between views on my app. When navigating at first on dev mode using ionic serve everything works as expected, but when trying to go back from the waitTime to borderList view by clicking the nav back button the view does not reload, I am trying to figure out what am I missing, here are my controllers and app.js files:

app.js:

   .state('app.border', {
        url: "/border",
        views: {
            'borderList': {
                templateUrl: 'templates/borders.html'
            }
            },
            data: {
                requiresLogin: true
            }
        })
        .state('app.time', {
            url: '/time/:borderId',
            views: {
                'waitTime': {
                    templateUrl: 'templates/wait-time.html',
                    controller: 'TimeCtrl'
                }
            },
            data: {
                requiresLogin: true
            }
        })

controllers.js

ctrl.controller('BorderCtrl', function($scope, BorderService) {
    BorderService.getBorders().then(function(response) {
        $scope.borders = response.data;
    });
})

ctrl.controller('TimeCtrl', function($scope, $stateParams, TimeService) {
    TimeService.getWait($stateParams.borderId).then(function(response) {
        $scope.waitTimes = response.data;
    });
})

menu.html

<ion-side-menus enable-menu-with-back-views="false">
  <ion-side-menu-content>
    <ion-nav-bar class="bar-stable bar-positive">
      <ion-nav-back-button  class="button-clear">
      </ion-nav-back-button>
      <ion-nav-buttons side="left">
        <button class="button button-icon button-clear ion-navicon" menu-toggle="left">
        </button>
      </ion-nav-buttons>
    </ion-nav-bar>
    <ion-nav-view name="borderList"></ion-nav-view>
    <ion-nav-view name="waitTime"></ion-nav-view>
  </ion-side-menu-content>
  <ion-side-menu side="left">
    <ion-header-bar class="bar-stable bar-positive">
      <h1 class="title">Options</h1>
    </ion-header-bar>
    <ion-content>
      <ion-list>
        <ion-item nav-clear menu-close href="#/app/border">
          Borders
        </ion-item>
      </ion-list>
    </ion-content>
  </ion-side-menu>
</ion-side-menus>

#2

Views are cached since beta 14, check Caching section there : http://ionicframework.com/docs/api/directive/ionNavView/


#3

Ah, I disabled caching but it as no effect. Whenever I try to go back to the borderList view, the header changes to the correct template but the list still shows the data from the waitTime view instead of the borderList data.


#4

Ah nvm, I was tying different view names to different states within an abstract view. I changed that and now it works:

app.js:

.state('app.border', {
    url: "/border",
    views: {
        'borderContent': {
            templateUrl: 'templates/borders.html'
        }
    },
    data: {
        requiresLogin: true
    }
})
.state('app.time', {
    url: '/time/:borderId',
    views: {
        'borderContent': {
            templateUrl: 'templates/wait-time.html',
            controller: 'TimeCtrl'
        }
    },
    data: {
        requiresLogin: true
    }
});