Side menu: open page with params


#1

What I’m trying to do:

I want a side-menu from which I can change the currently viewed page. In my case the page shown is always the same page, but only the data-content for this page changes.
For example: Let’s say we have a side-menu that lists all users in the system. When I click on one of the users the ‘UserPage’ is shown, which receives an object that holds the user I have clicked on and displays the contents of the user object.

My Problem:

Currently according to the docs a page is opened like this and I don’t see a way to hand over parameters:

openPage(page) {
	this.rootPage = page;
	this.menu.close();
}

I want to be able to open a page and hand over some parameters like it’s possible through the NavController.
Is there a way to achieve this for a side-menu constellation?


#2

Try this…

@Component({
  templateUrl: 'build/app.html'
})
class MyApp {
  @ViewChild(Nav) nav: Nav;
  rootPage: any = Page1;
  constructor() {}
  openPage(page) {
    this.nav.setRoot(page, {
      'user': user
    });
  }
}

TL;DR
Use .setRoot to change the root and pass options


#3

That helped me a lot. Thank you


#4

is there anyway to disable the sidemenu in a particular page? as an example, at the tutorial page in the conference app the sidemenu should not be there.(suppose flash screen of the app) is there anyway to disable it?