@mflmartin wrote:
Hi,
I am using ionic 4, and working with modals.
The problem I have is that my modals only work, in a given page, when I import them directly in the app.module.ts, but If load them in the page’s module (in order for the modals to be loaded when that module loads), then they don’t work.
This is my modal module:
@NgModule({ declarations: [ScanListModal], imports: [ CommonModule, FormsModule, IonicModule, BasePageModule ], entryComponents: [ScanListModal] }) export class ScanListModalModule { }
And this is my page’s module, when loading the modal:
const routes: Routes = [ { path: '', component: ScanSessionPage } ]; @NgModule({ imports: [ CommonModule, FormsModule, IonicModule, RouterModule.forChild(routes), BasePageModule, CommonComponentsModule, ScanListModalModule ], declarations: [ScanSessionPage], providers: [], entryComponents: [], exports: [] }) export class ScanSessionPageModule { }
And that does not work. But if I remove the import there, and import the modal’s module in app.module.ts, it works.
But my guts tells me that I should just load that modal in the modules that actually use them, not globally for the app, right?
Any help would be appreciated.
Thanks!
Ionic: ionic (Ionic CLI) : 4.12.0 (C:\Users\marti\AppData\Roaming\npm\node_modules\ionic) Ionic Framework : @ionic/angular 4.3.1 @angular-devkit/build-angular : 0.13.8 @angular-devkit/schematics : 7.3.8 @angular/cli : 7.3.8 @ionic/angular-toolkit : 1.5.1 Cordova: cordova (Cordova CLI) : 8.0.0 Cordova Platforms : none Cordova Plugins : no whitelisted plugins (0 plugins total) System: Android SDK Tools : 26.1.1 (C:\Users\marti\AppData\Local\Android\sdk) NodeJS : v8.12.0 (C:\Program Files\nodejs\node.exe) npm : 6.9.0 OS : Windows 10
Posts: 1
Participants: 1