0

I have defined my Ionic side menu in app.html:

<ion-menu [content]="content" side="left">
  <ion-header>
    <ion-toolbar>
        <ion-title>Menu</ion-title>
    </ion-toolbar>
  </ion-header>

  <ion-content>
    <ion-list>
        <button  menuClose ion-item (click)="openProfilePage()">Start today's quiz</button>
    </ion-list>
  </ion-content>

</ion-menu>

Where can I define the function openProfilePage function. I mean in which file?

farahm
  • 1,326
  • 6
  • 32
  • 70

1 Answers1

1

You should define your function inside app.component.ts file.

public openProfilePage() {
    // Code here
}
theriddle2
  • 398
  • 3
  • 9
  • I'm getting `StaticInjectorError(AppModule)[Nav -> NavController]: StaticInjectorError(Platform: core)[Nav -> NavController]: NullInjectorError: No provider for NavController!` – farahm Oct 02 '18 at 15:01
  • Because I am doing `this.navCtrl.push(ProfilePage);` – farahm Oct 02 '18 at 15:01
  • OK, I solved this by using `import {App} from 'ionic-angular';` – farahm Oct 02 '18 at 15:07