Hello there,
I’m currently trying to create a persistent menu in my app but the “persistent” part of it is not working properly. The MenuToggle button appears and works correctly the first time you are sent to the new rootPage from the loginPage, but it dissapears after selecting a new root page from the side menu.
This is the code for my menu.ts
import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { CentroCostoMainPage } from '../centroCostoMain/centroCostoMain';
import { ProyectoMainPage } from '../proyectoMain/proyectoMain';
@Component({
selector: 'page-menu',
templateUrl: 'menu.html'
})
export class MenuPage {
rootPage;
centroCostoMainPage;
proyectoMainPage;
constructor(public navCtrl: NavController, public navParams: NavParams) {
this.rootPage = CentroCostoMainPage;
this.centroCostoMainPage = CentroCostoMainPage;
this.proyectoMainPage = ProyectoMainPage;
}
openPage(p) {
this.navCtrl.setRoot(p);
}
}
And for the menu.html
<ion-menu persistent="true" [content]="content" style="font-family:BoldYanoneKaffeesatz;">
<ion-header>
<ion-toolbar>
<ion-title>Menú</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-list>
<button ion-item (click)="openPage(centroCostoMainPage)">
Reporte de Presupuesto - Centros de Costo
</button>
<button ion-item (click)="openPage(proyectoMainPage)">
Reporte de Presupuesto - Proyectos
</button>
<button ion-item menuClose>
Cerrar Menu
</button>
</ion-list>
</ion-content>
</ion-menu>
<ion-nav #content [root]="rootPage"></ion-nav>
And finally for both CentroCostoMainPage and ProyectoMainPage the navbar code is:
<ion-header>
<ion-navbar hideBackButton color="header">
<ion-buttons left>
<button ion-button icon-only (click)="logOut()">
<ion-icon name="md-log-out"></ion-icon>
</button>
</ion-buttons>
<button ion-button menuToggle right>
<ion-icon name="menu"></ion-icon>
</button>
</ion-navbar>
</ion-header>
I’m pretty new to all this, so maybe I forgot something important. Any help or correction is appreciated.