Angular Navigation Problem

Hi. I’ve been trying to track down a bug in my app for several weeks and I’m not sure what else to try.

I’m using angular-ui-route to navigate my app.

On the main page of my app I have a simple list of jobs that, when a job is clicked, transition to a screen with the job detals. It’s simple master/detail setup and navigation works fine.

In another use the user navigates from the job detail to a third screen and then back to the jobs list. When this flow happens the navigation gets messed up. Specifically, the next time the user clicks on a job in the list they are displayed their previous selection. It’s as if ther previous job is still on the view stack. After navigating back to the list the problem goes away.

I notice that when this bug happens the detail controller does not get reloaded; the wrong detail screen is presented withot the detail controller getting a chance to update the data.

I’ve tried manipultaing $ionicHistory to clear the view stack, but I’m not sure what the problem is. Does anyone have any thoughts on what could be causing the controller to be reused without being reinitialized?


This solution worked:

$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) { if( === 'jobs-list') { console.log( 'Clearing view cache'); $ionicHistory.clearCache();