How to import components into pages?


Today i was debating with a coworker about the way to import components on my pages (on Ionic 3).

The way i was doing it its via component.module.ts
in this file i was importing a parent module (IonicModule) and then in every page (just where i needed) importing ComponentsModule

My coworker insist in the fact that you will not want to import whole ComponentsModule because it will affect scalability of the project because you have to import all components even if you don’t need them.

His solution consist in create that file in every component:
Also importing parent module (IonicModule) and then referencing just the name of the component in the page where we want to load our component.

I agree that if you are not using all the components you don’t have to import them all… but why does ionic generate component creates that structure, is there any other cleaner way to do this?

Thanks in advance, we are trying new ionic for the first time so don’t hate us!!


Are you lazy loading pages? Answering yes or no to that question can change a lot.

No we are not using lazy loading.

Offtopic: ¿Should we use it?¿Can you link me the docs where i can learn how to?