How to display drawer in all page except login page


#1

i want display drawer in all page and i get success to display it but problem is i don’t want to display on login
page.
code that i used

app.html

<ion-menu [content]="content">
<ion-toolbar>
<ion-title>Menu</ion-title>
</ion-toolbar>
<ion-content>
<ion-list>
<button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)">
{{p.title}}
</button>
</ion-list>
</ion-content>
</ion-menu>
<ion-nav [root]="rootPage" #content swipeBackEnabled="true"></ion-nav>

app.ts

export class MyApp {

@ViewChild(Nav) nav: Nav;

  rootPage: any = LoginTabPage;
  db : DatabaseHelper;

pages: Array<{title: string, component: any}>

  constructor(platform: Platform) {
    this.pages = [
      { title: 'Voucher Entry', component: VoucherentryPage },
      { title: 'Voucher Summary', component: VoucherSummaryInputPage }
    ];
    platform.ready().then(() => {
            StatusBar.styleDefault();
  }
  openPage(page) {
  this.nav.setRoot(page.component);
  }
}
enableProdMode();
ionicBootstrap(MyApp,[WebService]);

#2

do this in your login.ts

import { Component } from '@angular/core';
...
...

import { TaskListPage } from '../task-list/task-list';

@Component({
  templateUrl: 'build/pages/login/login.html',
})
export class LoginPage {

  constructor(private nav: NavController, private menu: MenuController) {

      this.menu.enable(false);

  } // end of constructor

  // on click of Login button
  doLogin() {
     
     // code to perform login
     // and setRoot to your specified page

     this.nav.setRoot(TaskListPage});
     // in my case if I want to change the page to `TaskListPage` after login
     // I must use above line of code in order to `setRoot`
     
  }

  onPageDidEnter() {
      // the left menu should be disabled on the login page
      this.menu.enable(false);
  }

  onPageDidLeave() {
      // enable the left menu when leaving the login page
      this.menu.enable(true);
  }

}

This works perfectly on ionic2 beta.10


#3

yes it’s works…again thank you…

how i set the icon for drawer… in all page…on click that icon open drawer


#4

Hi, do you have a sample code of the application? Thanks