Angular 13, a planned upgrade to Google’s popular TypeScript-based web framework, continues to take shape, with eight beta releases published as of September 24, impacting areas such as the router, core, and service workers.

Code for these can be found on GitHub. Among the key changes since the second beta, the router no longer replaces the browser URL when a new navigation cancels an ongoing navigation. This had caused URL flicker and served only to support some AngularJS hybrid applications. Hybrid apps that rely on navigationId to the router instead should subscribe to NavigationCancel events and conduct the location.replaceState themselves to add navigationId to the router state.

Elsewhere in recent Angular 13 betas:

  • The behavior of the SpyLocation used by the RouterTestingModule has been changed to match the behavior of browsers.
  • For the core, pure annotations are being added to static property initializers. Class properties with initializers that cause code execution can have side effects at module evaluation, similar in effect to module level code. Thus, optimizers cannot safely remove a class with such a static property, as potential side effects may impact application execution. To allow classes with these types of static properties to be optimized and removed if unused, the initializer expressions for the static properties can be annotated as pure.
  • Service worker cache is cleared in the safety worker to ensure stale or broken contents are not served in future requests.
  • For the platform-browser, the error message has been improved for a missing animation trigger.

The first two beta releases introduced changes to forms and the router.

For forms, Angular 13 debuts a new type, FormControlStatus, which is a union of all possible status strings for form controls. Also, AbstractControl.status has been narrowed from string to FormControlStatus and StatusChanges have been narrowed from Observable<any> to Observable<FormControlStatus>. Most applications should consume these new types seamlessly, according the Angular changelog.

For the router, a change has been proposed to fix a situation in which the default URL serializer would drop everything afterward, including a question mark in query parameters, resulting in incorrect parsing for a navigation to /path?q=hello?&other=123. This change provides for correct parsing.

Production releases of Angular are targeted for every six months, meaning version 13 would be published by November. The predecessor Angular 12 release arrived May 12.

Other changes proposed for Angular 13 include:

  • For the compiler-cli, a fix has been proposed to use correct module resolution context for absolute imports in d.ts files.
  • Also for the compiler-cli, analysis would be skipped for incremental builds for files without Angular behavior. In an incremental build, the compiler tries to reuse as much analysis data from a prior compilation as possible to avoid doing the analysis work again. For source files without Angular behavior, however, no analysis data would be recorded, with the result that the source file would be reanalyzed each build, even if nothing had changed. This commit avoids the analysis of such source files.
  • For the language service, support would be offered for autocomplete string literal union types in templates.
  • For the router, missing outlet events would be added to RouterOutletContract. This will be needed when components are rendered dynamically via the module federation at some point in the future.