I'm using Angular with the Ionic framework to build an app. I want to display the title of the previous screen in the header bar, next to the back button. Like so:
[ '<| title of previous screen' 'Title of current screen']
My thinking is to set a scope variable per view that I can then display in my title bar code.
I'm using this as index.html:
<body ng-app="MyApp">
<!-- The nav bar that will be updated as we navigate -->
<nav-bar animation="nav-title-slide-ios7"
type="bar-positive"
back-button-type="button-icon"
back-button-icon="icon icon-back"
back-button-label="{{backButtonLabel}}"
></nav-bar>
<!-- where the content of each page will be rendered -->
<nav-view animation="slide-left-right" back-button-label="{{backButtonLabel}}"></nav-view>
</body>
The problem is, the scope variable is only available within the context of nav-view, but not in nav-bar. So the variable doesn't update. When you replace back-button-label with something static like 'HOME' or something, it does work.
Any idea how I can display the title of the previous screen in the title bar?
I've set up this Plunkr to demonstrate: http://plnkr.co/edit/BWsCQ98GAdw0I00pvCCk