Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Angular import modules on parent of per nested component

Using Angular 12, We have hotel component, and a hotel module -> this imports all the required components and modules for a hotel. Within the hotel component.html, we loop through all the rooms and display a ‘hotel-room.component’.

Is it best practice (or performance issues?) to have a child ‘hotel-room.module’, and import only the required components and modules for a hotel room (baring in mind, there would be multiple hotel rooms on a page ), or to import all the modules and components required at the hotel module (parent) level.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If you are not going to use it anywhere else, there is no need for separate module. Otherwise, it would be very wise to create component module.

Unless you wanted to lazy-load that particular child component – then module is a way to go.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading