How to set icon in the side navigation panel menu in ionic 2 application

Viewed 587

i am trying to set icons on the side navigation panel of an ionic2 application, Please suggest how would i get this done? Here is my code :

export class MyApp {
  @ViewChild(Nav) nav: Nav;

 rootPage: any = MysplashPage;
 
private dashboardpage;
private gradesubjectpage;
private myhomepage;
  
 

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

  constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen) {
    this.initializeApp();
    this.pages = [
      { title: 'Explore', component: HomePage },
      { title: 'Dashboard', component: DashboardPage }
   ];
  }

  initializeApp() {
    this.platform.ready().then(() => {
      this.statusBar.styleDefault();
     // this.splashScreen.hide();
    });
  }

   openPage(pages) {

    if(pages.component == HomePage){
      this.nav.setRoot(HomePage);
    } else {
      this.nav.push(pages.component);
    }
 
  }
}
Here on the html page i am going to display it with the help of loop, where should i use the different icons for the menu items in the side navigation panel.
<ion-list>
      <button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)">
        <b>{{p.title}}</b>
      </button>
    </ion-list>

1 Answers
Related