How to pass data from Sidemenu to other Page while navigating


#1

my sidemenu control is in app.component.ts and html in app.html…

know i am Navigating from sidemenu to a page… here i need to transfer a data from tab to page but my control is in app.component.ts

Please give me a solution…

Thanks.


#2

it is same as usual. you don’t have to do anything extra.

if you navigate page from side menu like this =>
this.nav.setRoot(yourcomponent);

then you just have to pass value in parameters
this.nav.setRoot(yourcomponent,{param1:value});

and you have to get that param in corresponding component
this.param1 = this.navParams.get("param1");


#3

How about reverse, sending a parameter from page to sidemenu?


#4

if you use nav.pop() then you can’t pass value in parameters
in this case i use localstage to pass parameter :wink:


#5

yes we are doing same now, but not sure if its best option…or do away with side menu altogether and use something else


#6

Storage is a bad choice for in-app communication. It should only be used for things that need to persist across app restarts. For in-app communication, use a mutually injected service provider.