SCAM (Single Component Angular Module) organizes Angular applications around one NgModule per declarable: component, directive, or pipe. The module declares that building block and imports its dependencies, usually in the same file. SCAMs contain no routing, even when their component is routed. section 2.2.2
SCAMs make NgModule-based applications easier to evolve:
- Dependencies stay visible beside the component, directive, or pipe that uses them. section 2.2.2
- Individual building blocks can move between application areas with less refactoring. section 2.2.2
- Tests can mock direct dependencies while rendering the template non-shallowly. section 2.2.2
- Components can be lazy-loaded directly, producing smaller and more granular bundles. section 2.2.2
Employee components
An EmployeeComponentModule owns EmployeeComponent. EmployeeListComponent remains in EmployeeModule and imports EmployeeComponentModule, allowing the list template to use the employee component without placing both declarations in one feature module. section 2.2.2
SCAMs also provide a staged path to standalone Angular. Create SCAM modules for selected declarables, remove those declarables from other NgModules, and continue until feature modules contain only feature structure. Then mark each declarable as standalone, remove its SCAM module, replace module references with direct imports, remove feature modules, and finally replace AppModule with standalone provider APIs. section 2.5.2 section 2.7
