Doesn’t seem to work when the component being pushed to is part of a module, imported into the app.module.ts
, unless I’m doing something wrong.
See app.module.ts
:
import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
import { BlogPage } from '../pages/blog/blog';
import { ContactPage } from '../pages/contact/contact';
import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';
import { AuthModule } from '../auth/authModule';
import { firebaseConfig, firebaseAuthConfig } from './firebaseProject';
import { AngularFireModule } from 'angularfire2';
@NgModule({
declarations: [
MyApp,
BlogPage,
ContactPage,
HomePage,
TabsPage
],
imports: [
AuthModule,
IonicModule.forRoot(MyApp),
AngularFireModule.initializeApp(firebaseConfig, firebaseAuthConfig)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
BlogPage,
ContactPage,
HomePage,
TabsPage
],
providers: []
})
export class AppModule {}
Then this is the AuthModule
:
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { IonicModule } from 'ionic-angular';
import { LoginComponent } from './login/login';
import { RegisterComponent } from './register/register';
import { ResetpassComponent } from './reset/reset';
@NgModule({
imports: [
FormsModule,
CommonModule,
IonicModule
],
declarations: [
RegisterComponent,
LoginComponent,
ResetpassComponent
],
exports: [
RegisterComponent,
LoginComponent,
ResetpassComponent
]
})
export class AuthModule { }
And now, I want to do this in my home.ts
:
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { RegisterComponent } from '../../auth/register/register';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController) {
}
goRegister() {
this.navCtrl.push(RegisterComponent);
}
}
When I call the goRegister()
function, I get this error:
What changed with importing modules? What am I doing wrong?