The evolutions of Angular 13 veils
The major upgrade to the Angular client side web framework, based on Microsoft’s TypeScript and supporting the Ivy build engine, is available as a candidate release. The production version of Angular 13 is scheduled for November 3, 2021.
Among the changes mentioned in the Angular 13 release notes, there are several evolutions.
– Added support for TypeScript 4.4. Also note that since October 5, versions prior to TypeScript 4.4.2 are no longer supported in the kernel.
– The possibility of dynamically deactivating or activating integrated validators such as min, max and minLength.
– An API ViewContainerRef.createComponent simplified which allows the dynamic creation of components.
– Improved error messaging.
– Improved builds with the persistent capability “cache build by default”.
– The introduction of the Angular Package Format 13, which removes View Engine specific code from packages.
– The $ localize API is stable for internationalization.
– The ability to define custom conditions in ng_package.
Changes in navigation
Some of the other changes in Angular 13 are some related to navigation.
– The router no longer replaces the browser URL when the new navigation cancels a current navigation, which caused the URLs to flicker and only allowed some AngularJS hybrid applications to be supported. Hybrid applications that rely on navigationId on the router must subscribe to events NavigationCancel and perform the replaceState to add navigationId to the state of the router.
– The class wrappedValue is no longer supported by @angular/core, which can lead to compilation errors or runtime failures in case any libraries use wrappedValue. The use of wrappedValue should be deleted.
– The behavior of SpyLocation used by the RouterTestingModule has been modified to match the behavior of browsers.
– For the kernel, pure annotations are added to the initializers of static properties. Class properties with initializers that cause code to execute can have side effects during module evaluation, with an effect similar to that of module-level code. Thus, optimizers cannot safely drop a class with such a static property because the potential side effects can impact the execution of the application. To allow classes with these kind of static properties to be optimized and dropped if not in use, initialization expressions for static properties can be annotated as pure.
– The Service Worker cache is cleared in the Safety Worker to ensure that outdated or broken content is not served in future requests.
– For angular / platform-browser, the error message has been improved with a missing animation trigger.
– Angular 13 has a new type of forms called FormControlStatus, which brings together all possible state strings for form controls. What’s more, AbstractControl.status was reduced from the chain to FormControlStatus and StatusChanges has been reduced by Observable in Observable. Most apps should consume these new types transparently, according to Angular’s official changelog.
– For the router, a change was proposed to correct a situation where the default URL serializer dropped everything that followed, including a question mark in the query parameters, resulting in incorrect parsing for navigation to /path?q=hello?&other=123. This modification allows a correct analysis.
– Support for IE11 (Internet Explorer) has been removed.
Changes to the compiler
Finally, in the long list of changes, the compiler undergoes a few tweaks.
– For the compiler-cli, a fix was proposed to use the correct module resolver context for absolute imports in files d.ts.
– Still on the subject of the cli-compiler, it will not perform the analysis of files without Angular behavior in incremental builds. In an incremental build, the compiler tries to reuse as much analysis data as possible from a previous compilation to avoid doing the same parsing job again. However, for source files without Angular behavior, no scan data is saved, with the result that the source file is re-scanned on each compilation, even if nothing has changed. This commit avoids the analysis of such source files.
– For Angular Language Service, support will be offered for autocompletion of union types of literal strings in templates.
– For the router, the missing output events will be added to RouterOutletContract. This addition will be necessary later when the components are rendered dynamically via the Module Federation technology.
Delivery of a production version of the language is scheduled every six months. The previous version, Angular 12 was released on May 12. The production version of Angular 13 is slated for release on November 3. The code for this release candidate is available on GitHub.