Are modules required for each tab when using lazy loading?

Repo that demonstrates my issue: https://github.com/LloydVincent/lazyLoadTabs/commit/f803d94159276e559bf7e401b8ea91fde4a5be7f

What I’m trying to do is make an app that loads the a tabs page lazily, but without lazy loading the individual tabs (in the app I’m developing, I have some custom router-like behavior in place so I don’t want each tab change to affect the browser url/history).

In the code linked above, notice now I removed the module for the contact tab and just added the class into the TabsPage manually (the old non-lazy-loading way). This produces the error when the tab is clicked:

Error: Uncaught (in promise): Error: No component factory found for ContactPage. Did you add it to @NgModule.entryComponents?
Error: No component factory found for ContactPage. Did you add it to @NgModule.entryComponents?

(yes I did add it to the entry components for the tabs module)

Is this a limitation of the framework, or am I doing something wrong?

Sorry, just going to bump this once. If I don’t get any takers I guess I’ll try opening an issue on github.

I would be surprised if this was possible given the current state of affairs.

I’m having the same problem " Did you add it to @NgModule.entryComponents?" (but with a popover) and still could not find a solution. (see How to correctly implement a components.module.ts in Ionic)

The only way I could make it work was to add the component (in your case probably ContactPage ) into the declarations and entryComponents of app.module.ts

Have you find an better solution ?

I ended up opening an issue about this on github, and they responded saying they’re move it to their internal feature request list for consideration.

2 Likes