
Angular 12, a planned upgrade to Google’s popular TypeScript-based web framework, has moved to a release candidate stage, with the production version due in May. The upgrade brings enhancements related to performance, the compiler, DOM elements, and more.
Published April 21, the Angular 12 release candidate, accessible from GitHub, features a performance improvement to the compiler that reduces the amount of generated code for safe accesses and nullish coalescing. This is done by reusing variables in nested nullish coalescing expressions and not initializing temporary variables to null
.
Prior to the release candidate, there were 10 beta releases issued for Angular 12. New features and improvements in Angular 12 include the following:
- For the build system, applications will only be allowed to be built with the Ivy renderer, thus making minified UMDs redundant since they cannot be processed by NGCC.
- To improve compiler CLI performance, incremental compilation is allowed in the presence of redirected source files.
- For the compiler, support is offered for transforming component style resources.
- For the language service, Angular property completions are provided only in templates.
- Adding of a migration that casts the value of
fragment
to be non-nullable. - For the compiler-cli, a
context
option is introduced for any request that allows supplying arbitrary data in a type-safe way. This feature addresses the need to configure interceptors in HTTP client on a per-request basis. - For animations, DOM elements now are correctly removed when the root view is removed. This is a breaking change.
- To improve performance, unused methods have been removed from
DomAdapter
. - A new format is added to
localize-extract
, calledlegacy-migrate
, to generate a JSON file that can be used to map legacy message IDs to canonical ones. - Strict null checks will report on a fragment potentially being null. This is a breaking change.
- The type of the APP-INITIALIZER token has been changed to more accurately reflect the types of return values handled by Angular. This is a breaking change.
- Support has been added for disabling animations through
BrowserAnimationsModulewithConfig
. - The
emitevent
option was added forFormArray
andFormGroup
. This is a breaking change. - More fine-tuned control has been added in
routerLinkActiveOptions
. - Custom router outlet implementations are permitted.
- Support has been added for TypeScript 4.2, and support for TypeScript 4.0 and TypeScript 4.1 has been dropped.
- Implementing the
appendAll()
method onHttpParams
. - For forms, min and max validators are being introduced.
- Exporting of a list of HTTP status codes.
- Addition of a feature to the Angular Language Service that enables accessing the locations for components that use a template file.
- The addition of diagnostics to suggest turning on strictTemplates, providing a way for the language server to retrieve compiler options diagnostics.
- A patch adding an API to retrieve the template typecheck block for a template, if any, at a file location, and selection of the TS node in the TCB corresponding to the template node at which the request for a TCB was made. This will help with debugging.
- The addition of a command for getting components for a template file, for the language service.
A variety of bug fixes also are featured, affecting the compiler, compiler-cli, Bazel build tool, the router, and other parts of Angular. A full list of changes can be found on GitHub. The current Angular 11 line debuted as a production release in November.