Impossible navigation between pages

Hi,

I’ve tried to navigate between to pages with this following tutorial : http://blog.ionic.io/10-minutes-with-ionic-2-adding-pages-and-navigation/ but it does not work, I’ve exactly the same thing but when I click on the button, nothing is happening.

So I’ve tried to test an example given by the documentation :

      @Component({
         template: `
            <ion-header>
              <ion-navbar>
                 <ion-title>Login</ion-title>
                </ion-navbar>
              </ion-header>

      <ion-content>
        <button (click)="goToOtherPage()">
          Go to OtherPage
        </button>
      </ion-content>`
    })
    export class StartPage {
      constructor(public navCtrl: NavController) {}

      goToOtherPage() {
        //push another page onto the history stack
        //causing the nav controller to animate the new page in
        this.navCtrl.push(OtherPage);
      }
    }

    @Component({
      template: `
      <ion-header>
        <ion-navbar>
          <ion-title>Other Page</ion-title>
        </ion-navbar>
      </ion-header>

      <ion-content>I'm the other page!</ion-content>`
    })
    class OtherPage {}

But this is the same issue. When I’m clicking with the web browser on the button, nothing is happening.

Any ideas ?

Issue resolved !

Just had to add declarations of my Page into app.modules.ts file.

Something like that :

import {NewPage} from '../pages/my-new-page/my-new-page';
@NgModule({
  declarations: [
    MyApp,
    HomePage,
    NewPage  //ADDED LINE
  ],
  imports: [
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage,
    NewPage //ADDED LINE
  ],
  providers: []
})
export class AppModule {}
1 Like

Thanks Dude !!! Just wasted almost a day to find this solution