Ionic: NavParams in a child tab is lost after a page refresh
up vote
0
down vote
favorite
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?
angular ionic-framework navigation navparams
add a comment |
up vote
0
down vote
favorite
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?
angular ionic-framework navigation navparams
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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?
angular ionic-framework navigation navparams
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?
angular ionic-framework navigation navparams
angular ionic-framework navigation navparams
asked Nov 9 at 21:30
Anjil Dhamala
5212520
5212520
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233507%2fionic-navparams-in-a-child-tab-is-lost-after-a-page-refresh%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown