Ionic ion-nav-title not updating


#1

My problem is that, despite using ion-nav-title my nav bar title isn’t updating when coming from a child state from ui-sref.

But the nav bar updates fine when coming from a parent state.

I’ve followed this tutorial to improve the default Slide Menu example: http://robferguson.org/2015/01/07/ionics-sidemenu-template-and-nested-states/

Now my back button is a custom one

<ion-nav-buttons side="left">
	<button class="button button-icon button-clear" ui-sref="app.events.detail.subevents({eventId : eventDetails._id})">
		<i class="icon ion-arrow-left-c"></i>
	</button>
</ion-nav-buttons>

<ion-nav-title>
	<span ng-bind="subEventDetails.eventTitle"></span>: Participants
</ion-nav-title>

Here’s a plnkr to show my issue.

Scenario:

  1. slide menu; Events
  2. Title shows “List of Events”, the title is correct
  3. pick event 1 to see its sub events
  4. Title shows “Event 1: List of sub events”, the title is updated correctly
  5. pick sub event 1
  6. Title shows “SubEvent 1: List of Participants”, the title is updated correctly
  7. Go Back and the title will not change, it should revert back to “Event 1: List of sub events” but shows “SubEvent 1: List of Participants” instead. Note that the sub Events are displayed nevertheless…

Also, the problem doesn’t happen when going back from step 3, because I’m not using a dynamic ion-nav-title but a static ion-view title.

Hope someone has come accros this problem before, before I need the title to be dynamic.

Thanks for your help


#2

try add cache: false like this:

.state('app.events.detail', {
  url: "/:eventId",
  abstract: true,
  cache: false,
  views: {
    'menuContent@app': {
      templateUrl: "eventsDetailTabs.html",
      controller: 'EventCtrl'
    }
  }
})

.state('app.events.detail.subevents', {
  url: '/subevents',
  cache: false,
  views: {
    'event-subevents': {
      templateUrl: 'tab-subevents.html',
      controller: 'EventSubEventsCtrl'
    }
  }
})

#3

That fixed it thanks!

I only needed to use these on the abstract : true states.

I tried to use ion-view cache-view="false" before and it didn’t work.

It’s a bit strange because the title is coded on the view…

Can you help me understand why this fix worked?


#4

I do not know, maybe this is a bug, starting from version 1.0, view cache must within state provider