Lazy Loading Pages/Modules


#1

So I’m trying to implement the normal angular approach to lazy loading but am running into issues with loading some pages.

So I have a Reports module which consists of 3 pages. I defined the pages within the module that is lazily loaded, however when I try to navigate to any of these pages I just get the error telling me to add the pages to my @ngModule entryComponents, which I did…

Does anyone have a working example of lazily loading a module with multiple pages to navigate to?


#2

Read the official Ionic blog posts about lazy loading. There are at least two. Though what made the light bulb go off for me was reading through this repo.


#3

Right. I already read up on those and they make sense, however I struggle with having one module per page, it seems like overkill…

Is there a way for me to have pages without a module and import those pages in a separate module other than app.module?

Like I have my reports.module which has the ReportSummaryPage. This page then navigates to a DetailsPage but I don’t have a module defined for the DetailsPage. I want to define that page within the reports.module…

i hope that makes sense


#4

Any update on this, if it is possible or not?

I also want to have single module for multiple pages


#5

That’s an Angular approach to Web apps, i.e

{
 path: 'admin', 
 loadChildren: '../../app/admin/admin.module#AdminModule', 
 canLoad: [AuthGuard]
 }

But Ionic doesn’t have a routing system that works this way. As far as I know, what you want to do is

  1. Not possible or
  2. Not suggested

I believe the point of Lazy Loading in Ionic IS to have a module per page.