This guide contains information to update to Angular version 14.
For step-by-step instructions on how to update to the latest Angular release and leverage the Angular automated migration tools, use the interactive update guide at update.angular.io.
For information about the deprecation and removal practices of Angular, see Angular Release Practices.
Strictly Typed Reactive Forms
The Reactive Forms types AbstractControl
, FormControl
, FormGroup
, and FormArray
now support a generic parameter which allows for strict typing of the controls. An automatic migration will convert existing usages of these types to special Untyped
aliases which preserve the existing behavior.
The initialValueIsDefault
option for FormControl
construction has been deprecated in favor of the nonNullable
option (which has identical behavior). This renaming aligns the FormControl
constructor with other strictly typed APIs related to nullability.
ComponentFactory
and NgModuleFactory
cleanup
Many APIs which use either ComponentFactory
or NgModuleFactory
have been deprecated and replaced with new APIs that use component or NgModule classes directly.
Details | |
---|---|
PR #45729 |
initialNavigation: 'enabled' was deprecated in v11 and is replaced by initialNavigation: 'enabledBlocking'. . |
PR #42803 | Forms email input coercion: forms email input value will be considered as true if it is defined with any value rather than false and 'false'. |
PR #33729 | Objects with a length key set to zero will no longer validate as empty. This is technically a breaking change, since objects with a key length and value 0 will no longer validate as empty. This is a very minor change, and any reliance on this behavior is probably a bug anyway. |
PR #44921 | Do not run change detection when loading Hammer. This change may cause unit tests that are implicitly asserting on the specific number or the ordering of change detections to fail. |
PR #23020 | Parameter types of TransferState usage have increased type safety, and this may reveal existing problematic calls. |
PR #43863 | The type of Navigation#initialUrl has been narrowed to UrlTree to reflect reality. Additionally, the value for initialUrl now matches its documentation: "The target URL passed into the Router#navigateByUrl() call before navigation". Previously, this was incorrectly set to the current internal UrlTree of the Router at the time navigation occurs. |
PR #45114 | The AnimationDriver.getParentElement method has become required, so any implementors of this interface are now required to provide an implementation for this method. |
PR #45176 | The type of Route.pathMatch is now more strict. Places that use pathMatch will likely need to be updated to have an explicit Route /Routes type so that TypeScript does not infer the type as string . |
PR #44573 | The router now takes only the first emitted value by the resolvers and then proceeds with navigation. This is now consistent with Observables returned by other guards: only the first value is used. |
PR #45394 | TypeScript versions older than 4.6.0 are no longer supported. |
PR #45210 |
HttpClient will throw an error when headers are set on a JSONP request. |
PR #43834 | Reactive form types such as FormControl and FormGroup now have generic type parameters and infer stricter types. A migration will convert existing usages to new Untyped -prefixed aliases which preserve the existing behavior. |
PR #45487 | The deprecated aotSummaries field in the TestBed configuration has been removed. |
PR #45648 | A new required class member LocationStrategy#getState has been added, that any implementers of this interface will need to provide. |
PR #45735 | When a guard returns a UrlTree , the router would previously schedule the redirect navigation within a setTimeout . This timeout is now removed, which can result in test failures due to incorrectly written tests. |
Removed | Replacement | Details |
---|---|---|
FormControlOptions#initialValueIsDefault | FormControlOptions#nonNullable | The initialValueIsDefault option for FormControl construction has been deprecated in favor of the nonNullable option (which has identical behavior). This renaming aligns the FormControl constructor with other strictly typed APIs related to nullability. |
ErrorEvent s passed to [TestRequest#error ](api/common/http/testing/TestRequest#error] | ProgressEvent | Http requests never emit an ErrorEvent . Use a ProgressEvent instead. |
getModuleFactory | getNgModuleById |
NgModuleFactory itself is deprecated. |
ModuleWithComponentFactories | n/a | Ivy JIT mode doesn't require accessing this symbol. See JIT API changes due to ViewEngine deprecation for additional context. |
Compiler | n/a | Ivy JIT mode doesn't require accessing this symbol. See JIT API changes due to ViewEngine deprecation for additional context. |
CompilerFactory | n/a | Ivy JIT mode doesn't require accessing this symbol. See JIT API changes due to ViewEngine deprecation for additional context. |
NgModuleFactory | n/a | This class was mostly used as a part of ViewEngine-based JIT API and is no longer needed in Ivy JIT mode. See JIT API changes due to ViewEngine deprecation for additional context. Angular provides APIs that accept NgModule classes directly (such as PlatformRef.bootstrapModule and createNgModuleRef ), consider switching to those APIs instead of using factory-based ones. |
ComponentFactory | n/a | Angular no longer requires ComponentFactory s. Other APIs allow Component classes to be used directly. |
ComponentFactoryResolver | n/a | Angular no longer requires ComponentFactory s. Other APIs allow Component classes to be used directly. |
useJit and missingTranslation in CompilerOptions
| n/a | Ivy JIT mode does not support these options. See JIT API changes due to ViewEngine deprecation for additional context. |
JitCompilerFactory | n/a | Ivy JIT mode doesn't require accessing this symbol. See JIT API changes due to ViewEngine deprecation for additional context. |
RESOURCE_CACHE_PROVIDER | n/a | This was previously necessary in some cases to test AOT-compiled components with View Engine, but is no longer since Ivy. |
relativeLinkResolution in the Router ExtraOptions
| Switch to the default of 'corrected' link resolution | This option was introduced to fix a bug with link resolution in a backwards compatible way. Existing apps which still depend on the buggy legacy behavior should switch to the new corrected behavior and stop passing this flag. |
resolver argument in RouterOutletContract.activateWith
| n/a |
ComponentFactory and ComponentFactoryResolver afre deprecated, and passing an argument for a resolver to retrieve a ComponentFactory is no longer required. |
`OutletContext#resolver | n/a |
ComponentFactory and ComponentFactoryResolver are deprecated, and using a resolver to retrieve a ComponentFactory is no longer required. |
SwUpdate#activated | Return value of SwUpdate#activateUpdate
| The activated property is deprecated. Existing usages can migrate to SwUpdate#activateUpdate . |
SwUpdate#available | SwUpdate#versionUpdates | The behavior of SwUpdate#available can be achieved by filtering for the VersionReadyEvent from SwUpdate#versionUpdates
|
© 2010–2022 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/guide/update-to-latest-version