Component Selector is not working with lazy loading in ionic 3

I think class names XXXPage should be reserved for actual pages, not components that can be embedded, so I’m just going to pretend for the moment that this thing is called OpportunityComponent.

You have a few options, and I’m going to warn you up front that if you use OpportunityComponent in a lot of places, lazy loading might not be for you. Its code is going to end up duplicated in every page that uses it.

  • The official suggestion (which I personally think is worse than the other two, but I am sure that I’m just ignorant about this) is to make one ComponentsModule, put all your components in it, and import it in the page modules of every page that uses them. This is described in the doc you linked.

  • The way I was doing it before I decided to give up on lazy loading for now is described in this post. Each component gets its own module.

  • You can put OpportunityComponent in the main app module and it will be available to everybody, but will not be lazily loaded.