I having the following modal in ionic 3:
import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { LoginModalPage } from './login-modal';
@NgModule({
declarations: [
LoginModalPage,
],
imports: [
IonicPageModule.forChild(LoginModalPage),
],
entryComponents: [LoginModalPage]
})
export class LoginModalPageModule {}
I want to use in app.component.ts/html:
import { LoginModalPage } from '../modals/login-modal/login-modal';
import { LoginModalPageModule } from '../modals/login-modal/login-modal.module';
export function init_app(appLoadService: InitializerService) {
return () => {
return appLoadService.initializeApp();
}
}
@NgModule({
declarations: [
MyApp,
HomePage,
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp, {
preloadModules: true
}),
IonicPageModule.forChild(MyApp),
HttpClientModule,
LoginModalPageModule
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
GatewayService,
UserService,
GlobalVarService,
AuthGuardService,
HttpClient,
InitializerService,
{
provide: APP_INITIALIZER,
useFactory: init_app,
deps: [InitializerService],
multi: true
},
]
})
export class AppModule {}
But I got the following error:
core.js:1449 ERROR Error: Uncaught (in promise): Error: No component factory found for [object Object]. Did you add it to @NgModule.entryComponents? Error: No component factory found for [object Object]. Did you add it to @NgModule.entryComponents?
I tried to add it inside entry component of app.module.ts, but got the following error:
LoginModalModule is declared in 2 components