ng update
to update Angular applications more than one major version at a time. Shows all the information we have about this update.
Review these changes and perform the actions to update your application.
ng update @angular/core@16 @angular/cli@16
to update your application to Angular v16.RouterEvent
, which means that if you're using the Event type you may have to change the type definition from (e: Event)
to (e: Event|RouterEvent)
NavigationEnd
the routerEvent
property now also accepts type NavigationSkipped
RendererType2.styles
because it no longer accepts nested arraysBrowserPlatformLocation
because MockPlatformLocation
is now provided by default in tests. Read further.Router.createUrlTree
you may have to readjust tests which mock ActiveRoute
. Read furtherApplicationConfig
to be from @angular/core
.renderModule
instead of renderModuleFactory
because it has been deleted.XhrFactory
from @angular/common
instead of XhrFactory
export from @angular/common/http
.BrowserModule.withServerTransition({ appId: 'serverApp' })
make sure you set the APP_ID
instead since withServerTransition
is now deprecated. Read furtherEnvironmentInjector.runInContext
to runInInjectionContext
and pass the environment injector as the first parameter.ViewContainerRef.createComponent
without the factory resolver. ComponentFactoryResolver
has been removed from Router APIs.APP_IDs
.renderApplication
method as it no longer accepts a root component as first argument, but instead a callback that should bootstrap your app. Read furtherPlatformConfig.baseUrl
and PlatformConfig.useAbsoluteUrl
platform-server config options as it has been deprecated.@Directive
/@Component
moduleId
property as it does not have any effect and will be removed in v17.import {makeStateKey, StateKey, TransferState} from '@angular/platform-browser'
to import {makeStateKey, StateKey, TransferState} from '@angular/core'
ComponentRef.setInput
to set the component input even if it's the same based on Object.is
equality check, make sure you copy its value.ANALYZE_FOR_ENTRY_COMPONENTS
injection token as it has been deleted.entryComponents
is no longer available and any reference to it can be removed from the @NgModule
and @Component
public APIs.EventManager
method addGlobalEventListener
has been removed as it is not used by Ivy.BrowserTransferStateModule
is no longer available and any reference to it can be removed from your applications.Injector.create
rather than ReflectiveInjector
since ReflectiveInjector
is removed.QueryList.filter
now supports type guard functions. Since the type will be narrowed, you may have to update your application code that relies on the old behavior.ng update @angular/core@17 @angular/cli@17
to update your application to Angular v17.REMOVE_STYLES_ON_COMPONENT_DESTROY
provider to false
.setupTestingRouter
, canceledNavigationResolution
, paramsInheritanceStrategy
, titleStrategy
, urlUpdateStrategy
, urlHandlingStrategy
, and malformedUriErrorHandler
in provideRouter
or RouterModule.forRoot
since these properties are now not part of the Router
's public APIngDoCheck
during change detection if the component is marked as dirty. You may need to update your tests or logic within ngDoCheck
for dynamically instantiated components.UrlSerializer.parse
instead of malformedUriErrorHandler
because it's now part of the public API surface.zone.js/bundles/zone-testing.js
and zone.js/dist/zone
to zone.js
and zone.js/testing
.AnimationDriver.NOOP
to use NoopAnimationDriver
because AnimationDriver.NOOP
is now deprecated.NgSwitch
because now it defaults to stricter check with ===
instead of ==
. Angular will log a warning message for the usages where you'd need to provide an adjustment.update
instead of mutate
in Angular Signals. For example items.mutate(itemsArray => itemsArray.push(newItem));
will now be items.update(itemsArray => [itemsArray, …newItem]);
ngSkipHydration
or remove the provideClientHydration
call from the provider list since withNoDomReuse
is no longer part of the public API.loadComponent
routes to inherit data from their parent specify the paramsInheritanceStrategy
to always
, which in v17 is now set to emptyOnly
.