Docs
/
Angular
Chapter 25

25 — Migration & Version Updates

Angular Release Cycle

TypeFrequencyExample
MajorEvery 6 months17 → 18 → 19
MinorMonthly17.1 → 17.2
PatchWeekly17.2.0 → 17.2.1
LTS18 months support per majorv16 LTS until Nov 2024

ng update — Official Update Tool

# Check what needs updating
ng update

# Update Angular core + CLI
ng update @angular/core @angular/cli

# Update Angular Material
ng update @angular/material

# Update with specific version
ng update @angular/core@18 @angular/cli@18

# Force update (skip peer dependency checks)
ng update @angular/core --force

# Allow version jump
ng update @angular/core --allow-dirty

Update Steps (Safe Process)

# 1. Create a branch
git checkout -b update/angular-18

# 2. Run update
ng update @angular/core @angular/cli

# 3. Fix any breaking changes (ng update shows migration notes)

# 4. Update other dependencies
ng update @angular/material        # If using Material
npm outdated                       # Check other deps

# 5. Run tests
ng test
ng e2e

# 6. Build
ng build --configuration=production

# 7. Commit and PR
git add -A
git commit -m "chore: update Angular to v18"

Key Migration Guides

Angular 16 → 17

ChangeAction
Standalone by defaultNew components are standalone; migrate existing with ng g @angular/core:standalone
New control flowReplace *ngIf@if, *ngFor@for, *ngSwitch@switch
@defer blocksUse for lazy-loading template sections
esbuild (default)Faster builds; check for webpack-specific config
View TransitionsAdd withViewTransitions() to router
# Auto-migrate to standalone
ng generate @angular/core:standalone

# Auto-migrate to new control flow
ng generate @angular/core:control-flow

Angular 17 → 18

ChangeAction
Stable signalsMove from @Input() to input(), @Output() to output()
@let in templatesDeclare local template variables
Zoneless (experimental)Opt in with provideExperimentalZonelessChangeDetection()
Route redirectsredirectTo function support
Material 3Update theming to M3 APIs

Angular 18 → 19

ChangeAction
Incremental hydrationUse @defer (hydrate on ...) for SSR
Linked signalsUse linkedSignal() for dependent writable signals
Resource APIUse resource() for async data loading
Standalone defaultstandalone: true no longer needed (it's the default)
Strict standaloneComponents without standalone: false are standalone

Auto-Migration Schematics

# Migrate to standalone components
ng generate @angular/core:standalone

# Migrate to new control flow (@if, @for, @switch)
ng generate @angular/core:control-flow

# Migrate to signal inputs
ng generate @angular/core:signal-input

# Migrate to signal queries (ViewChild → viewChild)
ng generate @angular/core:signal-queries

# Migrate outputs
ng generate @angular/core:output-migration

# Migrate to inject() function
ng generate @angular/core:inject-migration

# Remove unnecessary standalone: true (Angular 19+)
ng generate @angular/core:standalone-migration

Common Breaking Changes to Watch

AreaCommon IssueFix
RxJSDeprecated operators removedUse new imports from rxjs
HttpClientHttpModuleprovideHttpClient()Update providers
RouterCanActivate class → CanActivateFnUse functional guards
FormsTyped forms (Angular 14+)Add generics to FormGroup
MaterialTheme API changesUpdate SCSS imports
TypeScriptStricter checks in new TS versionsFix type errors
Node.jsMinimum version bumpsUpdate Node.js

Handling Deprecated APIs

// ❌ Deprecated in Angular 15
@NgModule({
  providers: [{ provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true }],
})

// ✅ Modern (Angular 15+)
provideHttpClient(withInterceptors([authInterceptor]))

// ❌ Deprecated
canActivate: [AuthGuard]  // Class-based guard

// ✅ Modern
canActivate: [authGuard]  // Functional guard

// ❌ Deprecated (RxJS)
import { map } from 'rxjs/operators';

// ✅ Modern (RxJS 7.2+)
import { map } from 'rxjs';

Staying Updated

# Check Angular update guide
# https://angular.dev/update-guide

# Check current Angular version
ng version

# Check for updates
ng update

# Check npm outdated
npm outdated

# Check Angular blog for release announcements
# https://blog.angular.dev/

Version Compatibility Matrix

AngularTypeScriptNode.jsRxJS
195.5–5.720, 227.x
185.4–5.518, 20, 227.x
175.2–5.418, 207.x
164.9–5.116, 187.x

Key Takeaways

  • Update Angular one major version at a time — don't skip versions
  • Always use ng update — it runs migration schematics that auto-fix breaking changes
  • Create a branch for updates — test thoroughly before merging
  • Run auto-migration schematics for standalone, control flow, signals, and inject()
  • Check the Angular Update Guide for version-specific steps
  • Keep TypeScript and Node.js versions aligned with Angular's compatibility matrix
  • Subscribe to Angular blog releases to stay ahead of deprecations