liveBook · Manning

SCAM

As explained in Modern Angular

SCAM (Single Component Angular Module) is an Angular organization pattern that packages a single component or declarable in its own NgModule with its related dependencies.

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

How Modern Angular covers it

How deep it goes
Explains module boundaries, dependency placement, routing exclusion, testing, code splitting, and staged standalone migration.
Examples
Uses EmployeeComponent, EmployeeListComponent, EmployeeModule, and Listing 2.5 to show a component SCAM imported by a feature module.
What it assumes
Uses existing NgModule-based applications as the starting point and introduces standalone concepts during migration.
What you can do after
Apply it via NgModules and migrate declarables incrementally to standalone building blocks.
How it connects
Connects declarables with NgModules, feature modules, lazy loading, standalone components, directives, pipes, and migration schematics.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern Angular. The section links point to the parts of the book it draws on.