Consider a parent TabsPage with IonicPage() decorator as such:
@IonicPage({
segment: 'case/:caseId/summary/:summaryId'
})
Pass the navParams
of the TabsPage as rootParams
to all the child tabs pages.
Navigate to the child tab and log the navParams instance in constructor. Also log navParams instance in parent TabsPage constructor.
export class TabsPage {
constructor(private _navParams: NavParams){
console.log(this._navParams);
}
}
export class AboutPage {
constructor(private _navParams: NavParams){
console.log(this._navParams);
}
}
In a normal flow, when one navigates from a different page to one of the child pages of the tabs navigation, passing {caseId: 123, summaryId: 234}
as navParams, you'll see the same navParams being logged in both parent and child's constructor.
export class LandingPage{
goToTabsPage() {
this.navCtrl.push("TabsPage", {caseId: 123, summaryId: 2345});
}
}
However, if you are in the child tab and hit browser reload, you'll see the navParams {caseId: 123, summaryId: 234}
in the parent TabsPage constructor but not in the child tab.
export class TabsPage {
constructor(private _navParams: NavParams){
console.log(this._navParams);
}
}
//This prints {caseId: 123, summaryId: 234}
export class AboutPage {
constructor(private _navParams: NavParams){
console.log(this._navParams);
}
}
//This prints {}
Is this an Ionic bug or am I missing something?