qchap qchap - 1 month ago 60
TypeScript Question

Use nav.push with side menu in ionic 2

I try to make a little app in

to learn about it but I have a problem with navigation.

In fact I have well understand the difference between a
(change whit
) and a "normal" page (add with
). The thing is for my app I'll need to be able to open a side menu (this is ok if I'm on a
but not it's not ok with the second type of page) and to be able to go back (this is ok with a push page but not with a rootpage).

So for me this type of page should be push and not a root page but how repear side menu on this type of page?

Thank you.



What about using persistent="true" in your ion-menu item? Like you can see in Ionic2 docs:

Persistent Menus Persistent menus display the MenuToggle button in the NavBar on all pages in the navigation stack. To make a menu persistent set persistent to true on the element. Note that this will only affect the MenuToggle button in the NavBar attached to the Menu with persistent set to true, any other MenuToggle buttons will not be affected.

So your app.html woul be:

<ion-menu [content]="content" persistent="true">


      <button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)">
      <button menuClose ion-item (click)="logout()">Logout</button>


<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>