Migrations
Learn about how you can migrate your existing angular project to the latest features incrementally.
- Standalone: Standalone components provide a simplified way to build Angular applications. Standalone components specify their dependencies directly instead of getting them through NgModules.
- Control Flow Syntax: Built-in Control Flow Syntax allows you to use more ergonomic syntax which is close to JavaScript and has better type checking. It replaces the need to import
CommonModuleto use functionality like*ngFor,*ngIfand*ngSwitch. - inject() Function: Angular's
injectfunction offers more accurate types and better compatibility with standard decorators, compared to constructor-based injection. - Lazy-loaded routes: Convert eagerly loaded component routes to lazy loaded ones. This allows the build process to split production bundles into smaller chunks, to load less JavaScript at initial page load.
- New
input()API: Convert existing@Inputfields to the new signal input API that is now production ready. - New
output()function: Convert existing@Outputcustom events to the new output function that is now production ready. - Queries as signal: Convert existing decorator query fields to the improved signal queries API. The API is now production ready.
- Cleanup unused imports: Clean up unused imports in your project.
- Self-closing tags: Convert component templates to use self-closing tags where possible.
- NgClass to Class Bindings: Convert component templates to prefer class bindings over the
NgClassdirectives when possible. - NgStyle to Style Bindings: Convert component templates to prefer style bindings over the
NgStyledirectives when possible. - RouterTestingModule migration: Convert
RouterTestingModuleusages toRouterModulein TestBed configurations and addprovideLocationMocks()when appropriate. - CommonModule to standalone imports: Replace imports of the
CommonModulewith imports of the individual directives and pipes used in the templates when possible. - Injectable to Service: Convert eligible
@Injectableclasses to the@Servicedecorator.