can anyone help me with examples of how to use getRootNavById?
What are you trying to achieve?
I have 3 pages
page1
page2
page3
currently to send:
this.app.getRootNav (). setRoot (page2, {data: this.getData});
but get message from: (getRootNav) is deprecated and will be removed in the next major release. Use getRootNavById instead.
so I want to know how to go from page1 to page2 with getRootNavById.
Typically one would just inject a NavController
in page1 and call its push()
method with page2 and whatever extra parameters are required. That’s the flow users will be expecting.
If i’m inside of a tab and i want to set root another page calling a function… what’s the proper way to achieve this?
Actually i use this:
this.app.getRootNav().setRoot(OfflinePage,{text: '505'});
ok so I got this going for now, but…
if they change the id, Im in deep doo, doo.
first i did…
console.log(this.app.getRootNav().id);
and got -
n4
n4 scares me
so i did
let newRootNav = <NavController>this.app.getRootNavById('n4');
newRootNav.push(DrugCardEmailPage,{...}
this works but if they change the name, and we loose getRootNav().id
aaaah…
please don’t remove this capability, Ioinc Team
Just gonna link my post which has the same subject getRootNav() deprecated, use getRootNavById(): what's the value of the root nav id?
and also the github issue https://github.com/ionic-team/ionic-site/issues/1197