Unable to switch views


#1

Hello, this is my first time using Ionic (or Angular or any other crazy JavaScript framework) and I’m having problems switching from my home page to a page I created. I used the “blank” template so I assume there’s some magic thing somewhere that I missed when I made the page. The @Component class is called SettingsPage and the declaration is nearly identical to that of my home page class but when this.navCtrl.push(SettingsPage); is run it just reloads the home page. I thought I probably needed to add SettingsPage to the entryComponents property of the base module, but when I do that I just get a blank screen instead of my homepage.

I’m using Ionic 2.1.1 on Ubuntu 16.04 xenial. Cordova version 6.3.1, node version 6.9.0

Sorry if this has been posted before but I didn’t see anything that seemed related and everyone else on here seems to understand this platform a lot better than me.


#2

I fixed it! Turns out I needed to add it to declarations of the base module as well. Don’t know how I missed it. Here’s how it’s supposed to look:

@NgModule({
  declarations: [
    MyApp,
    HomePage,
    SettingsPage
  ],
  imports: [
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage,
    SettingsPage
  ],
  providers: []
})
export class AppModule {}