Angular 900

Guide Leading Up to Angular 9.0.0 Release

Changes up to Angular 9.0.0, including bug fixes, breaking changes, deprecations, code refactoring, features, and performance improvements.

Ladies and gentlemen, after a 3-month delay, the official version of Angular 9.0.0 is released to the public. (Who knows, perhaps this would also delay the release of the Angular 10.0.0 that was planned to be released in May 2020… We’ll see.)

However, what does Angular 9.0.0 have? Let’s check out the highlights of the Next and Release Candidate versions.

In this article, we’ve compiled the changes that were introduced in versions of Angular 9.0.0-next.1 to Angular 9.0.0-RC.14, including bug fixes, breaking changes, reverts, deprecations, code refactoring, features, and performance improvements.

Angular website: angular.io
Angular changelog on GitHub: github.com/angular/changelog

ANGULAR V9.0.0 (FEBRUARY 6, 2020)

The official release highlights and the CLI-powered automated update workflow are available on the official website in the angular v9 release announcement.

How to update to Angular v9: 

  • Update your project to the latest version of Angular 8: ng update @angular/cli@8 @angular/core@8
  • Then update it to Angular v9: ng update @angular/cli @angular/core
  • Detailed update instructions can be found here: update.angular.io

Dependency updates

  • @angular/core now requires RxJS 6.5
  • @angular/compiler-cli now requires TypeScript 3.6 or 3.7

ANGULAR 9.0.0-RC.14 (FEBRUARY 3, 2020)

Features

  • performance improvement for eventListeners

Bug Fixes

  • ivy:
    • host-styling doesn’t throw assert exception inside *ngFor
  • ngcc:
    • cache correctly invalidated when moving/removing files/directories
    • if the target is not compiled by Angular, ngcc isn’t locked

ANGULAR 9.0.0-RC.13 (FEBRUARY 1, 2020)

Features for ngcc:

  • now outdated ngcc artifacts are cleaned automatically

Bug Fixes

  • compiler-cli: 
    • sass is added as a valid CSS preprocessor extension
    • subclass Promise without Symbol.species is allowed
  • common:
    • http/testing expectOne lists the received requests if no matches
    • extra & in http params is removed

ANGULAR 9.0.0-RC.12 (JANUARY 30, 2020)

Features

  • ivy: 
    • static priority resolution is the same level as the directive it belongs to
  • language-service: 
    • completions for output $event properties as well as completions for $event variable
    • added hover for the micro syntax in the structural directive

Performance Improvements for Ivy: 

  • the unused argument in hostBindings function is removed

Bug Fixes

  • ivy:
    • FatalDiagnosticError thrown from the pre-analysis phase is caught
    • DebugNode/DebugElement are tree-shakeable in Ivy 
    • multi providers in ModuleWithProviders are not duplicated
    • ViewContainerRef gets the correct parentInjector
  • language-service:
    • duplicate returned definitions are pruned
    • repeated symbol definitions for structural directive are removed
    • added a warning instead of an error for missing context members
    • the filename in code-frame error messages is re-enabled
  • ngcc:
    • lockfile error message is improved

ANGULAR 9.0.0-RC.11 (JANUARY 24, 2020)

Features

  • common:
    • getLocaleCurrencyCode exposed publicly
  • compiler-cli:
    • node 10 is required as runtime engine
  • language-service:
    • specific suggestions for template context dialogs
    • multiple symbol definitions supported
  • ngcc:
    • ngcc is locked when processing

Performance Improvement for Ivy

  • more styling use-cases are added to benchmarks

Bug Fixes

  • ivy:
    • component emitted correctly when it’s removed from its module
    • DebugNode.classes are working on SVG elements
    • aliasing is disabled in template type-checking
    • changes on detached child embedded views aren’t detected
    • eventListeners added outside angular context are not called
    • type-check for multiple bindings to the same input
    • type-check for properties which map to multiple fields
    • any is used for generic context checks when !strictTemplates
    • wrap ‘as any’ casts in parentheses when needed
  • language-service:
    • diagnostic span points to the class name
    • metadata in Declaration is non-optional
    • getDiagnostics is renamed to getSemanticDiagnostics
  • ngcc:
    • when analysis fails, the compilation isn’t attempted
    • private declarations aren’t collected from external packages
    • libraries using spread in object literals are processed
    • ngcc is locked only after targeted entry-point check
    • package.json updated deterministically

ANGULAR 9.0.0-RC.10 (JANUARY 22, 2020)

The Angular 9.0.0-rc.10 version came out with a few bug fixes. Can the absence of new features or performance improvements mean that we’re close to the official release? 

Bug Fixes

  • ‘noImplicityAny’ incompatibility that appeared due to ts3.7 update is fixed
  • when removing parent in Ivy, you no longer need to wait for child animations to finish
  • diffing in ngStyle/ngClass correctly emits value changes
  • LOCALE_ID is set after app initializers in Ivy
  • pipes in host bindings are detected more accurately
  • DTS deep imports aren’t added to missing packages list in ngcc

ANGULAR 9.0.0-RC.9 (JANUARY 15, 2020)

Features

  • common:
    • default currency code is now configurable
  • ivy: 
    • ExpressionChangedAfterChecked error message for attributes is improved
  • language-service:
    • template reference variables support completions
  • i18n
    • locale data includes currency code
  • language-service
    • completion for $event variable is added
    • hover/definitions for the structural directive are now supported

Performance Improvements for Ivy

  • create scenario and noop change detection are added to the styling benchmark
  • static style is added to the list of scenarios
  • the performance of styling algorithm benchmark is improved

Bug Fixes

  • forms:
    • number length is accepted in length validators
    • disabled input acceptance member is now properly applied
  • ivy:
    • view dirty state isn’t reset in check no changes mode
    • decorator handlers don’t run against declaration files
    • overloaded constructors are handled in ngtsc
    • ngClass now applies classes with trailing/leading spaces
    • errors are prevented during DebugElement roots query that were outside angular context
    • components with attribute selectors are bootstrapped correctly
    • warnings are showed instead of throwing for unknown elements
  • language-service:
    • break the hover/definitions for two-way binding
    • CRLF offset in inline template
    • i18n parser isn’t used for templates
    • only directives are visited
  • ngcc: 
    • avoid error due to circular dependency in EsmDependencyHost
    • correctly detect dependencies in CommonJS
    • correctly handle inline exports in UMD
    • don’t crash if symbol has no declarations
    • handle UMD factories that do not use all params
    • insert definitions after statement
    • recognize re-exports with require() calls in UMD
    • recognize re-exports with imported TS helpers in CommonJS and UMD

ANGULAR 9.0.0-RC.8 (JANUARY 8, 2020)

Features

  • compiler:
    • records the end of expression token
  • language-service:
    • symbol type to hover tooltip was added
    • documentation is shown on hover

Performance Improvements

  • Ivy now supports simple generic type constraints in local type ctors

Bug Fixes

  • common:
    • trailing whitespace for CurrencyPipe was removed
  • ivy: 
    • advance instructions before i18nExp are appended
    • output bound events are correctly associated with directives
    • ngProjectAs marker name appears now at even attribute index
    • field inheritance is skipped if InheritDefinitionFeature is present on parent def
    • TestBed now wraps imports array function when overriding provider
  • language-service:
    • the bug with completions after “let x of |” in ngFor was fixed
    • expressions in an attribute are parsed correctly
    • The pipe method no longer includes parentheses
  • ngcc:
    • entry-point dependencies are captured from typings as well as the source
    • trailing commas are no longer added in UMD imports

ANGULAR 9.0.0-RC.7 (DECEMBER 18, 2019)

Features

  • forms:
    • NgModel disabled type expanded to work with strict template type checking
  • ivy:
    • An error shows now when inheriting a ctor from an undecorated base
    • A compilation error shows when providing undecorated classes

Performance Improvements

  • compiler:
    • cloning cursors state optimized
    • i18n digest computations work faster now
    • shared interpolation regex is used 
  • ivy:
    • export scopes extracted from declaration files are cached
    • the template is parsed twice during the analysis
    • prior analysis work is used during incremental builds
    • instances of DomElementSchemaRegistry are shared
    • module resolution cache is used

Bug Fixes

  • animations:
    • when a parent has a leave transition, the leaking detached nodes are fixed
  • common:
    • ngStyle ignores undefined values now
  • ivy:
    • duplicate errors are avoided in safe navigations and template guards
    • when reading metadata in JIT mode, proto isn’t used
    • template diagnostics aren’t produced when the scope is invalid
    • better error is generated for template var writes
    • i18n – the translate function is removed when clearing translations
    • i18n instructions are no longer thrown off by sanitizer in IE11
    • ExpressionChangedAfterChecked error is improved
    • DebugNode.attributes on IE now has a consistent attribute casing
    • correct injectable name is now logged in warning message on IE
    • JIT mode inheritance is working correctly now on IE10
    • injectable definition inheritance from undecorated class is working correctly on IE10 in JIT mode
    • correct absolute source span is recorded for ngForOf expressions
    • provider type checks reordered to align with VE
    • unknown property and element checks are now working correctly in IE
    • NgModule declarations field now has validation
  • language-service:
    • HTML path includes the last node before the cursor
    • properties and events now have proper completions
    • let and of in ngFor completions are removed
  • ngcc:
    • aliased classes are matched correctly between src and dts files
    • CommonJS re-exports are handled by reference
    • imports in dts files are handled when processing UMD
    • UMD re-exports now are handled and UMD imports are rendered even in the case of no prior imports
    • correct identifiers are used when updating typings files

ANGULAR 9.0.0-RC.6 (DECEMBER 11, 2019)

Performance improvements for Ivy:

  • Chain listener and chain styling instructions are added

Bug Fixes

  • bazel: 
    • improved performance of tsHost.writeFile()
  • common:
    • closure locales updated to include directionality data
  • compiler:
    • localized strings are ES5 compatible for JIT mode
    • modern diagnostic formatting
  • compiler-cli:
    • declaration-only template type check members allowed
  • ivy:
    • a flag added to skip non-exported classes
    • TestBed.overrideProvider aligned with what happens with providers in TestBed providers array
    • change detection is not invoked for destroyed views
    • SafeStyles in [style.prop] is handled correctly
    • static coercion members are inherited from base classes
    • ternary expressions are properly parenthesized when emitted
    • when DI can’t inject a ctor param, the error is more correct
  • language-service:
    • accessing a string index signature using dot notation bug is fixed
    • getExternalFiles() is removed
    • js primitive type name is returned
    • resolution logic in the banner is simplified
  • ngcc: 
    • bundle rootDir is the package path
    • undecorated child migration is fixed when exportAs is present
    • Angular error codes are logged correctly
    • diagnostics from migrations are reported

ANGULAR 9.0.0-RC.5 (DECEMBER 4, 2019)

Performance Improvements

  • js-web-frameworks benchmark was added
  • duplicate state lookup and default function parameters are now avoided in Ivy

Bug Fixes

  • bazel:
    • @angular/core is no longer relied on as a dependency for @angular/bazel installation
    • template type checking in ng_module was reenabled
  • common: 
    • the input type is reflected in NgForOf and NgIf contexts
  • compiler: 
    • whitespace trimmed from i18n custom ids
  • compiler-cli & core: 
    • ngI18nClosureMode is guarded in generated code
  • ivy: 
    • insertion of views attached to a different container is now allowed
    • -1 consistently returned from ViewContainerRef.indexOf for non-inserted view
    • ngProjectAs templates correctly supported
    • XLIFF placeholders parsed correctly
    • HTML foreign objects inside SVG are correctly validated
    • ICUs are supported with pipes
  • language-service: 
    • the correct type for ngFor exported values is determined
    • if the metadata for NgModule is not found, the diagnostics are not produced
    • Symbol.specics of Promise implemented
    • parentheses are inserted for method completion 
    • missing modules are suggested instead of an error message
    • host.errror() is used instead of console.error()
  • ngcc:
    • legacy i18n message IDs are rendered by default

ANGULAR 9.0.0-RC.4 (NOVEMBER 27, 2019)

Features for language service:

  • completions support indexed types and tuple (immutable) arrays

Performance improvements for Ivy:

  • if a viewRef is moved to the same position, no work is done
  • time micro-benchmarks creation bug is fixed
  • NgModuleDefs that were already processed aren’t processed again (R3TestBed)

ANGULAR 9.0.0-RC.3 (NOVEMBER 20, 2019)

Features

  • bazel:
    • now you can use bazel v1.1.0 thanks to updated ng-add
  • core:
    • missing-injectable migration should migrate empty object literal providers

Performance Improvements

  • ivy: 
    • has an added micro-benchmark focused on directive input update
    • no longer stores public input names in two places
    • extracts template’s instruction first create pass processing
    • improves the performance of transplanted views

Bug Fixes

  • bazel:
    • added terser as an optional peer dependency
  • compiler-cli:
    • getTsTypeFromBuiltinType was refactored
  • core:
    • QueryList implements Iterable in the type system
  • ivy:
    • the program is not constantly reanalyzed during incremental rebuilds
    • cyclical dependency on imports is avoided
    • constant object literals aren’t shared across element and component instances
    • ivy no longer infers the template context types in full mode
    • fs-relative paths aren’t emitted when rootDir(s) aren’t in effect
    • added an ExpressionChangedAfterItHasBeenCheckedError for SafeValue
    • the assertion extended in directiveInject function to support IcuContainers
    • i18n – ensures that colons in i18n metadata are not rendered
    • i18n – supports “”, “`” and “${” sequences in i18n messages
    • moves setClassMetadata calls into a pure life 
    • properly inserts views before ng-container with injected ViewContainerRef
    • properly inserts views into ViewContainerRef injected by querying
    • watch mode diagnostics are reported correctly
    • resets style property value defined using [style.prop.px]
    • retains JIT metadata unless JIT mode is explicitly disabled
    • shadows all DOM properties in DebugElement.properties
    • supports for #id bootstrap selectors
  • language-service:
    • makes Function alias callable
    • provides completions for attribute values
    • recomputes analyzed modules only when source files change
    • removed getTemplateReferences() from LanguageService API
  • ngcc:
    • always adds exports for ModuleWithProviders references
    • correctly associate decorators with aliased classes
    • correctly include internal .d.ts files
    • do not emit ES2015 code in ES5 files
    • generate correct metadata for classes with getter/setter properties
    • properly detect the origin of constructor param types
  • router:
    • make routerLinkActive work with query params which contain arrays
  • zone.js:
    • fixes typo of zone.js patch vrdisplaydisconnected property

ANGULAR 9.0.0-RC.2

Breaking change for i18n:

  • The CLDR data has been updated to v36.0.0, which may cause some localized data strings to change. For example, the space separator used in numbers in the fr locales changed from \xa0 to \u202f.

Performance improvements for core:

  • Now avoids unnecessary creating provider factory

Reverts/fixes for Ivy:

  • When template changes in ngc watch mode, the component recompiles
  • If the user compiles modules with TestBed, this is the only case when registered modules can be restored
  • R3TestBed now cleans up registered modules after each test

ANGULAR 9.0.0-RC.1

Features

  • common:
    • support loading locales from a global
  • ivy:
    • graceful evaluation of unknown or invalid expressions
  • ivy:
    • implement unknown element detection in jit mode

Performance Improvements to Ivy

  • add new benchmark focused on template creation
  • add ngIf-like directive to the ng_template benchmark
  • avoid native node retrieval from LView
  • avoid repeated native node retrieval and patching
  • avoid repeated tNode.initialInputs reads
  • move local references into consts array

Bug Fixes

  • compiler-cli: 
    • attach the correct viaModule to namespace imports
    • pass SourceFile to getLeadingTriviaWidth
    • remove unused CLI private exports
  • core: 
    • renderer-to-renderer2 migration not migrating methods
    • undecorated-classes-with-di migration should report config errors
  • ivy:
    • event handlers avoid implicit errors
    • fixed several crash issues related to unknown localref target and unknown pipe
    • more descriptive errors for nested i18n sections
  • language-service:
    • should no longer crash if expr ends unexpectedly
  • ngcc:
    • handle new __spreadArrays tslib helper
    • override getInternalNameOfClass() and getAdjacentNameOfClass() for ES5
    • render adjacent statements after static properties
    • render new definitions using the inner name of the class
  • service-worker:
    • ensure initialization before handling messages

ANGULAR 9.0.0-NEXT.7

Bug Fixes

  • bazel:
    • ng_package(data) should support non-text files
  • compiler-cli: 
    • fix typo in the diagnostic template info
  • core: 
    • initialize global ngDevMode without top-level side effects
    • make injector.get() return default value with InjectFlags.Self flag
  • ivy: 
    • avoid unnecessary i18n instructions generation for with structural directives
    • correct debug array names
    • DebugNode throws exceptions when querying some properties
    • ensure that window.ng utilities are published when NgModules are used
    • i18n – start generated placeholder name at PH
    • i18n – update the compiler to output MessageIds
    • i18n – use MessageId for matching translations
  • language-service: 
    • Lazily instantiate MetadataResolver
    • Use tsLSHost.fileExists() to resolve modules
  • ngcc:
    • consistently use outer declaration for classes
    • correctly read static properties for aliased classes
    • resolve imports in .d.ts files for UMD/CommonJS bundles
    • support UMD global factory in comma lists

Features

  • bazel:
    • support ts_library targets as entry-points for ng_package
  • core: 
    • add dynamic queries schematic
    • Mark TestBed.get as deprecated
  • ivy:
    • expose window.ng.getDebugNode helper
    • i18n – add syntax support for $localize metadata block
    • i18n – reorganize entry-points for better reuse
  • language-service: 
    • enable logging on TypeScriptHost
    • provide diagnostic for invalid templateUrls
    • provide diagnostics for invalid styleUrls

Performance Improvements

  • ivy: 
    • avoid metamorphic reads during property binding
    • avoid repeated view reads in pipe instructions
    • avoid repeated LView reads in property instructions
    • avoid unnecessary DOM reads in styling instructions
    • binding update benchmark
    • convert all node-based benchmark to use a testing harness
    • guard listening to outputs with isDirectiveHost
    • initialize TNode inputs/outputs on the first creation pass
    • introduce a benchmark for listeners registration
    • limit TNode.outputs reads
    • run the expanding rows benchmark with es2015
  • language-service:
    • keep analyzedModules cache when source files don’t change

Deprecations

  • core: 
    • TestBed.get function is marked as deprecated, use TestBed.inject instead.

ANGULAR 9.0.0-NEXT.6

Bug fixes

  • core:
    • improve the “missing $localize” error message
  • ivy:
    • capture template source mapping details during preliminary analysis 
    • handle expressions in i18n attributes properly
    • i18n – do not generate jsdoc comments for $localize 
    • maintain coalesced listeners order 
    • match class and attribute value without case-sensitivity 
    • node placed in incorrect order inside ngFor with ng-container 
    • restore global state after running refreshView 
    • template compiler should render correct $localize placeholder names 
    • unable to bind to properties that start with class or style 
    • unable to override ComponentFactoryResolver provider in tests 
    • warn instead of throwing for unknown properties
  • service-worker:
    • keep serving clients on older versions if the latest is invalidated
  • ngcc:
    • only back up the original prepublishOnly script and not the overwritten one
  • language-service:
    • Return empty external files during project initialization 
    • Use module resolution cache 

Code Refactoring

  • bazel:
    • remove @angular/bazel protractor rule now provided by @bazel/protractor

Features

  • language-service:
    • add definitions for styleUrls 
    • add a script to rebuild, refresh Angular dist
  • service-worker:
    • recover from EXISTING_CLIENTS_ONLY mode when there is a valid update

Performance Improvements

  • ivy:
    • check for animation synthetic props in dev mode only 
    • introduce a node-based micro-benchmarks harness 
    • replace select instruction with advance
    • run tree benchmark with bundles and ngDevMode off
  • ngcc:
    • process tasks in parallel in async mode

Breaking changes

  • bazel:
    • Angular bazel users using protractor_web_test_suite from @angular/bazel npm package should now switch to the @bazel/protractor npm package.

ANGULAR 9.0.0-NEXT.5

Bug fixes

  • ivy:
    • add missing closure extern for $localize 
    • ensure binding ordering doesn’t mess up when a NO_CHANGE value is encountered 
    • 18n – handle translated text containing HTML comments 
    • ngcc – improve the “ngcc version changed” error message 
    • Prevent errors when querying for elements outside Angular context
  • ngcc:
    • handle compilation diagnostics
  • language-service:
    • create DirectiveKind enum
    • invalidate Reflector caches when the program changes
    • update all files/directories owned by DevInfra to new DevInfra Framework team alias
    • re-add regressed templateUrl tests 
    • use ts.CompletionEntry for completions
  • common:
    • HttpParams fromObject accepts ReadonlyArray

Features

  • ivy:
    • implement $localize() global function
  • language-service:
    • add definitions for templateUrl
  • core:
    • Adds DI support for providedIn: ‘platform’|’any’ 
    • Introduce TestBed.inject to replace TestBed.get

Performance Improvements

  • ivy:
    • add a microbenchmark for map-based style and class bindings 
    • add a microbenchmark for style and class bindings 
    • add element and text creation benchmark
    • guard directive-related operations with a TNode flag
    • properly initialize global state in the element_text_create benchmark
    • remove renderStringify calls for text nodes creation 
    • remove repeated memory read / write in addComponentLogic 
    • run registerPostOrderHooks in the first template pass only
  • core:
    • Make PlatformLocation tree-shakable

Reverts

  • docs:
    • create Issue and Pull Request markdown doc, explaining automatic locking policy

Breaking changes

  • ivy:
    • This commit removes the public export of hasBeenProcessed()
  • core:
    • Injector.get now accepts abstract classes to return type-safe values. The previous implementation returned any through the deprecated implementation.

ANGULAR 9.0.0-NEXT.4

Bug fixes

  • ivy:
    • debug node names should match user declaration
    • ngtsc throws if “flatModuleOutFile” is set to null
    • reset binding index before executing a template in refreshView call
  • ngcc:
    • does not analyze dependencies for non-Angular entry-points

Features

  • ivy:
    • use the schema registry to check DOM bindings
  • core:
    • add undecorated classes with decorated fields schematic

Performance Improvements

  • ivy:
    • minimize writes to the lView[BINDING_INDEX] / binding root 
    • store binding metadata in the ngDevMode only

ANGULAR 9.0.0-NEXT.3

Bug fixes

  • bazel:
    • pin [@microsoft](https://github.com/microsoft)/api-extractor
  • ivy:
    • get name directly from nativeNode
    • handle empty bindings in the template type checker 
    • in ngcc, handle inline exports in commonjs code
    • ngcc should only index .d.ts exports within the package 
    • ngTemplateOutlet error when switching between null and template value
    • run template type-checking for all components 
  • compiler:
    • return enableIvy true when using readConfiguration
  • ngcc:
    • handle deep imports that already have an extension
    • ignore format properties that exist but are undefined
  • language-service:
    • instantiate MetadataResolver once
    • remove ‘context’ used for module resolution
  • common:
    • update $locationShim to notify onChange listeners before emitting AngularJS events

Features

  • language-service:
    • support selector-less directive as base classes in Ivy
    • make the Ivy compiler the default for ngc 
    • convert all ngtsc diagnostics to ts.Diagnostics
  • core: 
    • add undecorated classes migration schematic
  • forms:
    • formControlName also accepts a number
  • compiler:
    • allow selector-less directives as base classes in View Engine

Performance Improvements

  • ivy:
    • auto-call select(0) for non-empty views only
    • avoid first template pass checks during view creation
    • avoid for-of loops at runtime
    • improve NaN checks in change detection
    • interpolation micro-benchmark
    • noop change detection micro-benchmark
    • don’t create holey arrays 
    • read selected index only when need in prop bindings
    • split hooks processing into init and check phases
    • split view processing into render (create) and refresh (update) pass
  • core:
    • make sanitization tree-shakable in Ivy mode

Breaking changes

  • ivy:
    • make Hammer support tree-shakable. Previously, in Ivy applications, Hammer providers were included by default. With this commit, apps that want Hammer support must import HammerModule in their root module.

ANGULAR 9.0.0-NEXT.2

Bug fixes

  • bazel:
    • disable treeshaking when generating FESM and UMD bundles
  • ivy:
    • reuse compilation scope for incremental template changes.
  • compiler:
    • do not remove whitespace wrapping i18n expansions 

Performance Improvements

  • ivy:
    • doesn’t read global state when interpolated values don’t change

ANGULAR 9.0.0-NEXT.1

Bug fixes

  • language-service:
    • getSourceFile() should only be called on TS files 
    • Make Definition and QuickInfo compatible with TS LS
  • upgrade:
    • compile downgraded components synchronously (if possible) 

* * *

HUSPI has been rated in the list of 100 best offshore software development firms of 2019.