Packages

@angular/upgrade

22.2.3 · 14 Oct 2026MIT104.4k / weekRepositoryHomepagenpmAtom feed

Your version

16.0.0

major3 May 2023Where it was published

16.2.12 is the newest release of 16.x.

In short

23 breaking8 deprecated

  • breaking

    Angular Compatibility Compiler (ngcc) has been removed and as a result Angular View Engine libraries will no longer work

  • breaking

    Several changes to the Angular Package Format (APF)

  • breaking

    MockPlatformLocation is now provided by default in tests. Existing tests may have behaviors which rely on BrowserPlatformLocation instead. For example, direct access to the window.history in either the test or the component rather than going through the Angular APIs (Location.getState()). The quickest fix is to update the providers in the test suite to override the provider again TestBed.configureTestingModule({providers: [{provide: PlatformLocation, useClass: BrowserPlatformLocation}]}). The ideal fix would be to update the code to instead be compatible with MockPlatformLocation instead.

  • breaking

    If the 'ngTemplateOutletContext' is different from the context, it will result in a compile-time error.

  • breaking

    Add the 'xxx' property to 'MyContext' with the correct type or

  • breaking

    Add '$any(...)' inside the template to make the error disappear. However, adding '$any(...)' does not correct the error but only preserves the previous behavior of the code.

  • breaking
    • TypeScript 4.8 is no longer supported.

  • breaking

    QueryList.filter now supports type guard functions, which will result in type narrowing. Previously if you used type guard functions, it resulted in no changes to the return type. Now the type would be narrowed, which might require updates to the application code that relied on the old behavior.

Release note

CommitDescription
refactor - 48aa96ea13remove Angular Compatibility Compiler (ngcc) (#49101)
refactor - 2703fd6260remove deprecated EventManager method addGlobalEventListener (#49645)

common

CommitDescription
feat - 5dce2a5a3aProvide MockPlatformLocation by default in BrowserTestingModule (#49137)
fix - d47fef72cbstrict type checking for ngtemplateoutlet (#48374)
refactor - c41a21658cremove deprecated XhrFactory export from http entrypoint (#49251)

compiler

CommitDescription
feat - 1a6ca68154add support for compile-time required inputs (#49304)
feat - 13dd614cd1add support for compile-time required inputs (#49453)
feat - 8f539c11f4add support for compile-time required inputs (#49468)
feat - 79cdfeb392drop support for TypeScript 4.8 (#49155)
feat - 1407a9aeafsupport multiple configuration files in extends (#49125)
fix - 9de1e9da8fincorrectly matching directives on attribute bindings (#49713)
fix - 6623810e4dProduce diagnositc if directive used in host binding is not exported (#49527)

compiler-cli

CommitDescription
feat - 03d1d00ad9Add an extended diagnostic for nSkipHydration (#49512)
fix - ed817e32feCatch FatalDiagnosticError during template type checking (#49527)
perf - 49fe974501optimize NgModule emit for standalone components (#49837)

core

CommitDescription
feat - 89d291c367add assertInInjectionContext (#49529)
feat - 4e9531f777add mergeApplicationConfig method (#49253)
feat - d7d6514addAdd ability to configure NgZone in bootstrapApplication (#49557)
feat - bc5ddabdcbadd Angular Signals to the public API (#49150)
feat - 17e9862653add API to provide CSP nonce for inline stylesheets (#49444)
feat - 605c536420add migration to remove moduleId references (#49496)
feat - 99d874fe3badd support for TypeScript 5.0 (#49126)
feat - d1617c449dallow removal of previously registered DestroyRef callbacks (#49493)
feat - b2327f4df1Allow typeguards on QueryList.filter (#48042)
feat - 061f3d1086Drop public factories property for IterableDiffers : Breaking change (#49598)
feat - fdf61974d1drop support for zone.js versions <=0.12.0 (#49331)
feat - 9c5fd50de4effects can optionally return a cleanup function (#49625)
feat - c024574f46expose makeStateKey, StateKey and TransferState (#49563)
feat - a5f1737d1cexpose onDestroy on ApplicationRef (#49677)
feat - e883198460implement takeUntilDestroyed in rxjs-interop (#49154)
feat - 0814f20594introduce runInInjectionContext and deprecate prior version (#49396)
feat - 0f5c8003ccintroduce concept of DestroyRef (#49158)
feat - 9b65b84cb9Mark components for check if they read a signal (#49153)
feat - 8997bdc03bprototype implementation of @angular/core/rxjs-interop (#49154)
feat - 585e34bf6cremove entryComponents (#49484)
feat - aad05ebeb4support usage of non-experimental decorators with TypeScript 5.0 (#49492)
fix - 6d7be42da7add newline to hydration mismatch error (#49965)
fix - f8e25864e8allow async functions in effects (#49783)
fix - 84216dabfccatch errors from source signals outside of .next (#49769)
fix - be23b7ce65ComponentRef.setInput only sets input when not equal to previous (#49607)
fix - 316c91b1a4deprecate moduleId @Component property (#49496)
fix - fd9dcd36cdEnsure effects can be created when Zone is not defined (#49890)
fix - 9180f98f0eensure takeUntilDestroyed unregisters onDestroy listener on unsubscribe (#49901)
fix - 4721c48a24error if document body is null (#49818)
fix - 2650f1afc1execute input setters in non-reactive context (#49906)
fix - f8b95b9da6execute query setters in non-reactive context (#49906)
fix - ef91a2e0feexecute template creation in non-reactive context (#49883)
fix - 87549af73cFix capitalization of toObservableOptions (#49832)
fix - 0e5f9ba6f4generate consistent component IDs (#48253)
fix - fedc75624cinclude inner ViewContainerRef anchor nodes into ViewRef.rootNodes output (#49867)
fix - df1dfc4c17make sure that lifecycle hooks are not tracked (#49701)
fix - c34d7e0822onDestroy should be registered only on valid DestroyRef (#49804)
fix - 2f2ef14f9eresolve InitialRenderPendingTasks promise on complete (#49784)
fix - c7d8d3ee37toObservable should allow writes to signals in the effect (#49769)
fix - b4531f1d82typing of TestBed Common token. (#49997)
fix - a4e749ffcaWhen using setInput, mark view dirty in same was as markForCheck (#49711)
perf - 9b9c818f99change RendererType2.styles to accept a only a flat array (#49072)
refactor - 82d6fbb109generate a static application ID (#49422)
refactor - 3b863ddc1eRemove ReflectiveInjector symbol (#48103)
refactor - f594725951remove Node.js v14 support (#49255)

forms

CommitDescription
feat - 07a1aa3004Improve typings form (async)Validators (#48679)

http

CommitDescription
feat - aff1512950allow HttpClient to cache requests (#49509)
fix - 15c91a53aedelay accessing pendingTasks.whenAllTasksComplete (#49784)
fix - 9f0c6d1ed1ensure new cache state is returned on each request (#49749)
fix - 45a6ac09fdforce macro task creation during HTTP request (#49546)
fix - 2a580b6f0bHTTP cache was being disabled prematurely (#49826)
fix - 2eb9b8b402wait for all XHR requests to finish before stabilizing application (#49776)

migrations

CommitDescription
feat - 5e5dac278dMigration to remove Router guard and resolver interfaces (#49337)

platform-browser

CommitDescription
feat - 761e02d912add a public API function to enable non-destructive hydration (#49666)
feat - 630af63faedeprecate withServerTransition call (#49422)
feat - 81e7d15ef6enable HTTP request caching when using provideClientHydration (#49699)
fix - 74c925c19cexport deprecated TransferState as type (#50015)
fix - 2312eb53efKeyEventsPlugin should keep the same behavior (#49330)
fix - c934a8e72bonly add ng-app-id to style on server side (#49465)
fix - 9165ff2517reuse server generated component styles (#48253)
fix - e8e36811d5set nonce attribute in a platform compatible way (#49624)
refactor - 3aa85a8087move ApplicationConfig to core (#49253)
refactor - 9bd9a11f4eremove deprecated BrowserTransferStateModule symbol (#49718)

platform-server

CommitDescription
feat - b5278cc115renderApplication now accepts a bootstrapping method (#49248)
feat - 056d68002fadd provideServerSupport function to provide server capabilities to an application (#49380)
feat - 7870fb07ferename provideServerSupport to provideServerRendering (#49678)
fix - a08a8ff108bundle @angular/domino in via esbuild (#49229)
fix - 5ea624f313remove dependency on @angular/platform-browser-dynamic (#50064)
refactor - e99460865edeprecate useAbsoluteUrl and baseUrl (#49546)
refactor - 41f27ad086remove renderApplication overload that accepts a component (#49463)
refactor - 17abe6dc96remove deprecated renderModuleFactory (#49247)

router

CommitDescription
feat - ea32c3289aExpose information about the last successful Navigation (#49235)
feat - 455c728525helper functions to convert class guards to functional (#48709)
feat - f982a3f965Opt-in for binding Router information to component inputs (#49633)
fix - 1f055b90b6Ensure anchor scrolling happens on ignored same URL navigations (#48025)
fix - 6193a3d406fix = not parsed in router segment name (#47332)
fix - c0b1b7becfRemove deprecated ComponentFactoryResolver from APIs (#49239)
fix - 1e32709e0eremove RouterEvent from Event union type (#46061)
fix - 3c7e637374Route matching should only happen once when navigating (#49163)
fix - 1600687fe5Route matching should only happen once when navigating (#49163)
fix - 31f210bf2cRouter.createUrlTree should work with any ActivatedRoute (#48508)

service-worker

CommitDescription
feat - 5e7fc259eaadd function to provide service worker (#48247)

Breaking Changes

  • breaking

    Angular Compatibility Compiler (ngcc) has been removed and as a result Angular View Engine libraries will no longer work

  • deprecated

    Deprecated EventManager method addGlobalEventListener has been removed as it is not used by Ivy.

bazel

  • breaking

    Several changes to the Angular Package Format (APF)

    • Removal of FESM2015

    • Replacing ES2020 with ES2022

    • Replacing FESM2020 with FESM2022

  • breaking

    Several changes to the Angular Package Format (APF)

    • Removal of FESM2015

    • Replacing ES2020 with ES2022

    • Replacing FESM2020 with FESM2022

common

  • breaking

    MockPlatformLocation is now provided by default in tests.
    Existing tests may have behaviors which rely on
    BrowserPlatformLocation instead. For example, direct access to the
    window.history in either the test or the component rather than going
    through the Angular APIs (Location.getState()). The quickest fix is to
    update the providers in the test suite to override the provider again
    TestBed.configureTestingModule({providers: [{provide: PlatformLocation, useClass: BrowserPlatformLocation}]}).
    The ideal fix would be to update the code to instead be compatible with
    MockPlatformLocation instead.

  • breaking

    If the 'ngTemplateOutletContext' is different from the context, it will result in a compile-time error.

Before the change, the following template was compiling:

interface MyContext {
  $implicit: string;
}

@Component({
  standalone: true,
  imports: [NgTemplateOutlet],
  selector: 'person',
  template: `
    <ng-container
      *ngTemplateOutlet="
        myTemplateRef;
        context: { $implicit: 'test', xxx: 'xxx' }
      "></ng-container>
  `,
})
export class PersonComponent {
  myTemplateRef!: TemplateRef<MyContext>;
}

However, it does not compile now because the 'xxx' property does not exist in 'MyContext', resulting in the error: 'Type '{ $implicit: string; xxx: string; }' is not assignable to type 'MyContext'.'

The solution is either:

  • breaking

    Add the 'xxx' property to 'MyContext' with the correct type or

  • breaking

    Add '$any(...)' inside the template to make the error disappear. However, adding '$any(...)' does not correct the error but only preserves the previous behavior of the code.

  • deprecated

    Deprecated XhrFactory export from @angular/common/http has been removed. Use XhrFactory from @angular/common instead.

compiler

  • breaking
    • TypeScript 4.8 is no longer supported.

core

  • breaking

    QueryList.filter now supports type guard functions, which will result in type narrowing. Previously if you used type guard functions, it resulted in no changes to the return type. Now the type would be narrowed, which might require updates to the application code that relied on the old behavior.

  • breaking

    zone.js versions 0.11.x and 0.12.x are not longer supported.

  • breaking
    • entryComponents has been deleted from the @NgModule and @Component public APIs. Any usages can be removed since they weren't doing anyting.

    • ANALYZE_FOR_ENTRY_COMPONENTS injection token has been deleted. Any references can be removed.

  • breaking

    ComponentRef.setInput will only set the input on the
    component if it is different from the previous value (based on Object.is
    equality). If code relies on the input always being set, it should be
    updated to copy objects or wrap primitives in order to ensure the input
    value differs from the previous call to setInput.

  • breaking

    RendererType2.styles no longer accepts a nested arrays.

  • breaking

    The APP_ID token value is no longer randomly generated. If you are bootstrapping multiple application on the same page you will need to set to provide the APP_ID yourself.

    bootstrapApplication(ComponentA, {
      providers: [
       { provide: APP_ID, useValue: 'app-a' },
       // ... other providers ...
      ]
    });
  • breaking

    The ReflectiveInjector and related symbols were removed. Please update the code to avoid references to the ReflectiveInjector symbol. Use Injector.create as a replacement to create an injector instead.

  • breaking

    Node.js v14 support has been removed

    Node.js v14 is planned to be End-of-Life on 2023-04-30. Angular will stop supporting Node.js v14 in Angular v16. Angular v16 will continue to officially support Node.js versions v16 and v18.

platform-browser

  • breaking

    The deprecated BrowserTransferStateModule was removed, since it's no longer needed. The TransferState class can be injected without providing the module. The BrowserTransferStateModule was empty starting from v14 and you can just remove the reference to that module from your applications.

platform-server

  • breaking

    Users that are using SSR with JIT mode will now need to add import to @angular/compiler before bootstrapping the application.

    NOTE: this does not effect users using the Angular CLI.

  • breaking

    renderApplication method no longer accepts a root component as first argument. Instead, provide a bootstrapping function that returns a Promise<ApplicationRef>.

    Before

    const output: string = await renderApplication(RootComponent, options);

    Now

    const bootstrap = () => bootstrapApplication(RootComponent, appConfig);
    const output: string = await renderApplication(bootstrap, options);
  • breaking

    renderModuleFactory has been removed. Use renderModule instead.

router

  • breaking

    The Scroll event's routerEvent property may also be
    a NavigationSkipped event. Previously, it was only a NavigationEnd
    event.

  • breaking

    ComponentFactoryResolver has been removed from Router APIs.
    Component factories are not required to create an instance of a component
    dynamically. Passing a factory resolver via resolver argument is no longer needed
    and code can instead use ViewContainerRef.createComponent without the
    factory resolver.

  • breaking

    The RouterEvent type is no longer present in the Event union type representing all router event types. If you have code using something like filter((e: Event): e is RouterEvent => e instanceof RouterEvent), you'll need to update it to filter((e: Event|RouterEvent): e is RouterEvent => e instanceof RouterEvent).

  • breaking

    Tests which mock ActivatedRoute instances may need to be adjusted
    because Router.createUrlTree now does the right thing in more
    scenarios. This means that tests with invalid/incomplete ActivatedRoute mocks
    may behave differently than before. Additionally, tests may now navigate
    to a real URL where before they would navigate to the root. Ensure that
    tests provide expected routes to match.
    There is rarely production impact, but it has been found that relative
    navigations when using an ActivatedRoute that does not appear in the
    current router state were effectively ignored in the past. By creating
    the correct URLs, this sometimes resulted in different navigation
    behavior in the application. Most often, this happens when attempting to
    create a navigation that only updates query params using an empty
    command array, for example router.navigate(, {relativeTo: route, queryParams: newQueryParams}). In this case, the relativeTo property
    should be removed.

Deprecations

core

- import {makeStateKey, StateKey, TransferState} from '@angular/platform-browser';
+ import {makeStateKey, StateKey, TransferState} from '@angular/core';
  • deprecated

    EnvironmentInjector.runInContext is now deprecated, with
    runInInjectionContext functioning as a direct replacement:

    // Previous method version (deprecated):
    envInjector.runInContext(fn);
    // New standalone function:
    runInInjectionContext(envInjector, fn);
  • deprecated

    The @Directive/@Component moduleId property is now
    deprecated. It did not have any effect for multiple major versions and
    will be removed in v17.

platform-browser

  • deprecated

    BrowserModule.withServerTransition has been deprecated. APP_ID should be used instead to set the application ID.
    NB: Unless, you render multiple Angular applications on the same page, setting an application ID is not necessary.

    Before:

    imports: [
      BrowserModule.withServerTransition({ appId: 'serverApp' }),
      ...
    ]

    After:

    imports: [
      BrowserModule,
      { provide: APP_ID, useValue: 'serverApp' },
      ...
    ],
  • deprecated

    ApplicationConfig has moved, please import ApplicationConfig from @angular/core instead.

platform-server

  • deprecated

    PlatformConfig.baseUrl and PlatformConfig.useAbsoluteUrl platform-server config options are deprecated as these were not used.