Skip to content

Upgrading @angular/platform-browser 17 to 18

Breaking17.3.12 → 18.2.14Breaking2Security1Deprecated1New8Changed4Fixed62Other2

Fetching 52 releases from GitHub…19 / 52
BreakingUpgrade verdict

2 breaking changes and a security fix.

  • Server-side apps must pass a new context object when starting up, and platform helpers behave differently on the server.
  • Tests using fakeAsync will now run any pending timers automatically when the test function finishes.
  • Fixes security-related Trusted Types violations in the upgrade package.
  • Deprecates the ignoreChangesOutsideZone option.
4 items need code or config changes

Node.js requirement changed in 18.1.0-next.1: ^18.13.0 || >=20.9.0 → ^18.19.1 || ^20.11.1 || >=22.0.0.

Breaking2
Server bootstrapping no longer relies on a global platform injector; bootstrapApplication now takes a BootstrapContext.
BootstrapContextbootstrapApplicationgetPlatform()destroyPlatform()main.server.ts
fakeAsync now flushes pending timers at the end of the given function by default.
fakeAsync
Security1
Addresses Trusted Types violations in @angular/upgrade.
@angular/upgrade
Deprecated1
Deprecates the ignoreChangesOutsideZone option.
ignoreChangesOutsideZone

Generated by DepDelta from published .d.ts files. Not mixed with prose notes.

  • changed: constructor ɵAsyncAnimationRendererFactory(doc: Document, delegate: RendererFactory2, zone: NgZone, animationType: 'animations' | 'noop', moduleImpl?: Promise<{ ɵcreateEngine: (type: 'animations' | 'noop', doc: Document, scheduler: ɵChangeDetectionScheduler | null) => ɵAnimationEngine; ɵAnimationRendererFactory: typeof ɵAnimationRendererFactory }> | undefined) → constructor ɵAsyncAnimationRendererFactory(doc: Document, delegate: RendererFactory2, zone: NgZone, animationType: 'animations' | 'noop', moduleImpl?: Promise<{ ɵcreateEngine: (type: 'animations' | 'noop', doc: Document) => ɵAnimationEngine; ɵAnimationRendererFactory: typeof ɵAnimationRendererFactory }> | undefined)
  • added: const ɵASYNC_ANIMATION_LOADING_SCHEDULER_FN: InjectionToken<(<T>(loadFn: () => T) => T)>
  • removed: const TransferState: { new (): TransferState_2 }
  • removed: const makeStateKey: typeof makeStateKey_2
  • removed: type StateKey<T> = StateKey_2<T>
  • removed: type TransferState = TransferState_2
  • changed: constructor ɵHammerGesturesPlugin(doc: any, _config: HammerGestureConfig, console: ɵConsole, loader?: HammerLoader | null | undefined) → constructor ɵHammerGesturesPlugin(doc: any, _config: HammerGestureConfig, console: ɵConsole, loader?: (HammerLoader | null) | undefined)
  • changed: constructor ɵSharedStylesHost(doc: Document, appId: string, nonce?: string | null | undefined, platformId?: object) → constructor ɵSharedStylesHost(doc: Document, appId: string, nonce?: (string | null) | undefined, platformId?: object)
  • changed: function bootstrapApplication(rootComponent: Type<unknown>, options?: ApplicationConfig): Promise<ApplicationRef> → function bootstrapApplication(rootComponent: Type<unknown>, options?: ApplicationConfig, context?: BootstrapContext): Promise<ApplicationRef>
  • added: function withEventReplay(): HydrationFeature<HydrationFeatureKind.EventReplay>
  • added: function withI18nSupport(): HydrationFeature<HydrationFeatureKind.I18nSupport>
  • added: interface BootstrapContext
  • added: member HydrationFeatureKind.EventReplay = 3
  • added: member HydrationFeatureKind.I18nSupport = 2
  • added: property BootstrapContext.platformRef: PlatformRef
  • changed: const platformBrowserTesting: (extraProviders?: StaticProvider[] | undefined) => PlatformRef → const platformBrowserTesting: (extraProviders?: StaticProvider[]) => PlatformRef