DEV Community

Discussion on: Emulating standalone components using single component Angular modules (SCAMs)

 
snowfrogdev profile image
Philippe Vaillancourt

The way I understand the SCAM approach and have been using it is not that you should literally have a module for every single component in your app. You should have one module for every single component that is reusable in isolation.

So, for instance, if I have a lazy-loaded OrderListModule that has a parent OrderListComponent and that parent has a child OrderDetailsComponent that is not reused anywhere in the app, I would just declare OrderDetailsComponent in the OrderListModule.

If I have a set of reusable components that are only meant to be used together, like in your example, I would also declare all of those in one module. If you look at the Angular Material project, that is how they do it.

Thread Thread
 
layzee profile image
Lars Gyrup Brink Nielsen

That would be a feature module.