Friday, February 5, 2021

Angular 11 Features

Angular 11 was released on Nov 11, 2020. Angular, Google’s JavaScript (TypeScript) framework for building web applications mobile or desktop. Highlights include stricter types, router performance improvements, and automatic inlining of fonts.

Other improvements in Angular 11 include:

  • Performance improvements and new APIs, with the parallel function making it easier to work with asynchronous actions in tests by enabling multiple asynchronous interactions with components in parallel.
  • Stricter types are added for DatePipe and number pipes, to catch misuses such as passing an Observable or an array.
  • Improved reporting and logging.
  • An update to the Angular Language Service, providing a more powerful and more accurate experience.
  • An update to Hot Module Replacement (HMR) support leverages the CLI to allow enablement of HMR when starting an application with ng serve.
  • Experimental Webpack 5 support offers a path to faster builds with persistent disk caching and smaller bundles thanks to CommonJS tree-shaking.
  • TSLint has been deprecated, with project creators recommending migration to ESLint.
  • For the Angular compiler, keySpan would be added to the Variable node.
  • The router in Angular 11 would change the default value of relativeLinkResolution from “legacy” to “corrected.” The migration updates RouterModule configurations that use the default value to now specifically use “legacy” to prevent breakages during updating.
  • In a fix to the core, a Trusted Types policy is being introduced in the development mode. It allows arbitrary unsafe conversions to Trusted Types to support development features. Also, a module is being added to create a Trusted Types policy for use internally by Angular.
  • New initialNavigation options are being added to legacy functionality.
  • For code refactoring in the router, the type of parameter in navigateByUrl and createUrlTree is being adjusted to be more accurate.
  • To improve router performance, ngDevMode can be used to tree-shake error messages.
  • For service-worker, an UnrecoverableStateError notification is being added, fixing an issue in which a broken state would arise where only parts of an application would load properly. This situation has arisen when the browser has evicted eagerly cached assets from the cache that cannot be found on the server anymore.
  • Support is removed for the Microsoft IE 9 and IE 10 browsers as is IE mobile support.
  • ISO week-numbering year formats support is being added to formatDate.
  • For the compiler-cli, interfaces are being defined that can be used for TemplateTypeChecker. Performance improvements have been made to compiler-cli, also.
  • For the core, a migration is being added that finds all imports and calls to the deprecated async function @angular/core/testing and replaces them with waitforasync.
  • null is now included in the types of .parent.
  • A multitude of bug fixes are planned, including an improvement to typing of common pipes and another fix to ensure TestBed is not instantiated before the override provder.
  • TypeScript 3.9 support has been removed from the compiler. An upgrade to TypeScript 4.0 is advised.