I have an ionic view like this -
<ion-nav-bar class="header-panel" align-title="center">
<h1 class="title offer-title">Title 1</h1>
</ion-nav-bar>
<ion-tabs class="tabs-royal">
<ion-tab title="Tab 1" href="#/somelink1">
<ion-nav-view name="someview1"></ion-nav-view>
</ion-tab>
<ion-tab title="Tab 2" href="#/somelink2">
<ion-nav-view name="someview2"></ion-nav-view>
</ion-tab>
</ion-tabs>
The someview1 and someview2 are bound to their respective controllers, but they can represent data dynamically, say with Id=1 or Id=2 or Id=3 and so on.
How can I access this Id information which the tabs hold in the parent level so I can change nav bar title dynamically like Title 1 or Title 2 or Title 3 respectively.
Essentially what I am asking is can we have a top level controller which holds information what child level controller data is?
Note: The routes are set-up using ui-router.
Thanks in advance.
Use a service (this will be your model) it is singleton so it will hold a consistent data.
yes you can and you should be able to pass it down through the child controllers using the resolve functionality of ui-router
See documentation for more details What Do Child States Inherit From Parent States?