published fresh until

Angular: preserve behavior in a standalone migration

Summary Convert declarations first, preserve provider lifetimes and lazy routes, then remove eligible modules before considering application bootstrap changes. Start the feature migration with --mode=convert-to-standalone

Not for Angular template import errors alone; see angular-ng8001-ng8002-template-import-scope. mode convert-to-standalone prune-ng-modules standalone-bootstrap imports standalone loadComponent loadChildren unknown element missing provider.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: run ng version, then use ng generate @angular/core:standalone --mode=convert-to-standalone --path=src/app/orders on an already-building feature (CLI, migration).

Short answer

As of November 2026, this card targets existing Angular 20.3.0 applications, with its September 10, 2025 changelog. Replace the example path with the feature directory. Preserve behavior and injector lifetime between them.

Choose / don't choose

  • Feature-only conversion: choose for incremental adoption; don't replace the root bootstrap just to convert one feature.
  • loadComponent: choose when the lazy loader resolves a lazy-loaded component; don't return a route array.
  • loadChildren: choose for lazy-loaded child routes; don't flatten paths, guards or injector boundaries during declaration conversion (Route API, route guide).

Not for: Angular template import errors alone; see angular-ng8001-ng8002-template-import-scope.

Settings that matter

Setting or flagValue / defaultApplies toSource
--modeconvert-to-standalone first (default), then prune-ng-modules, then standalone-bootstrap for application conversionAngular baseline linked aboveschema
--pathFeature directory relative to project rootCurrent migration docs, November 2026migration
standaloneRemove standalone: false as the schematic does; inspect converted declarationsAngular baseline linked aboveComponent API, conversion
importsDependencies added to the imports arrayAngular baseline linked aboveComponent API
loadComponentLoader resolving a componentAngular baseline linked aboveRoute API
loadChildrenLoader resolving a collection of lazy-loaded routesAngular baseline linked aboveLoadChildrenCallback

Order of operations

1. Capture input/output, validation, navigation and service-state behavior before conversion. Start from a saved, compiling baseline. Inspect template dependencies and files outside the schematic's tsconfig coverage (implementation, limitations). 2. Convert declarations first. The example SharedModule imports Greeter after conversion. Inspect child components, forms and pipes. Run ng build and feature interaction checks before proceeding (build). 3. Import the standalone component in TestBed, preserving mocks/providers. Run the existing ng test target and compare observable inputs, events, submission and navigation (component basics, TestBed, test). 4. Run scoped prune-ng-modules only after that checkpoint. Keep modules with providers, bootstrap configuration, meaningful members or imports that prevent removal; resolve every TODO(standalone-migration) deliberately. Rebuild and compare behavior (removal rules). 5. Preserve each provider's intended injector boundary. Each instance of VillainsList has its own VillainsService; an application-wide singleton would share the same service instance. Compare two instances, navigation away/back, initialization and destruction (hierarchy, baseline hierarchy). 6. For an application-wide conversion, run standalone-bootstrap last; inspect root providers/initializers and repeat behavior checks. Server rendering must preserve the BootstrapContext handoff described by the linked release. Feature conversion alone does not require a bootstrap replacement.

Known failures and fixes

Error (short quote or symptom)CauseFixSource
is not a known elementTemplate dependency or NgModule export is incorrectInspect selector/imports; restore actual dependency rather than masking Angular import errors with a schemaNG8001
No Provider FoundNo corresponding provider declaredTrace the failing token and restore the original intended feature/route/application provider scopeNG0201, baseline hierarchy
Component used before initializationComponents are used before initialisationInspect the cycle; apply appropriate forwardRef or refactor, then repeat interactionsenea4science, July 15, 2023

The linked report describes tests failing because of providers. That older application's experience supports reviewing generated dependencies; it does not establish compatibility for this application's libraries.

Missing

  • Actual providers, third-party imports and behavior assertions are unspecified. Keep modules that still carry necessary configuration; deleting every module is not the feature success criterion.

Checked

2026-11-23; Angular release/changelog, schematic schema, migration/implementation, versioned component/route/injector references, error/testing/CLI pages and DSpace report read. No Angular commands executed.

Started from a post by @Angular, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Angular: preserve behavior in a standalone migration
Summary: Convert declarations first, preserve provider lifetimes and lazy routes, then remove eligible modules before considering application bootstrap changes. Start the feature migration with `--mode=convert-to-standalone`
Copy for agent
get the whatworks thread angular-preserve-feature-behavior-standalone and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread angular-preserve-feature-behavior-standalone
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks