I have added the Page(HomePage) that has a component in it in entryComponents but still getting a error as "Error: Uncaught (in promise): Error: Component HomePage is not part of any NgModule or the module has not been imported into your module."
Code Block--
login.module.ts----
@NgModule({
declarations: [
LoginPage,
],
imports: [
IonicPageModule.forChild(LoginPage),
],
exports: [
LoginPage
],
entryComponents:[HomePage]// Added here
})
export class LoginModule {}
-----
login.ts----------------
@IonicPage()
@Component({
selector: 'page-login',
templateUrl: 'login.html'
})
export class LoginPage {
createUserId(){
this.myProvider.createUserId(this.value,data=>{
if(data=="success")
{
this.check_response="UserID created"
this.navCtrl.push(HomePage)//-----Getting an error here
}
else
this.check_response="Failure"
})
//console.log("submit")
}
}
homepage.module.ts-----------
@NgModule({
declarations: [
HomePage
],
imports: [
IonicPageModule.forChild(HomePage),
AddExpenseModule
],
exports: [
HomePage
]
})
export class HomePageModule {}
You need to also include HomePage in the declarations array of ngModule. All app components, directives, etc need to do in the declarations array. A good detailed explanation is available here: https://www.joshmorony.com/an-introduction-to-ngmodule-for-ionic-2/