Dev News Daily ENDE

Angular 22.2.2 tightens template compilation and fixes an afterRenderEffect ordering bug

The Angular team released Angular 22.2.2 on 8 October. It is a patch release with no new APIs; the notes list fixes in the compiler, the compiler CLI, core and forms. Most of them concern how templates are compiled — in particular templates that mix HTML with other XML namespaces such as SVG or MathML.

Compiler. Six fixes land here:

  • ::ng-deep detection state no longer leaks between CSS rules, so one rule's use of the deprecated combinator cannot change how the next rule is processed.
  • Entity resolution avoids prototype lookups: when the compiler resolves named HTML entities, it no longer consults inherited object properties.
  • Directives are correctly matched on <ng-template> elements nested in other namespaces, and namespaced root nodes of control-flow blocks are matched against ng-content selectors.
  • @let declarations are ignored by the diagnostic that checks content projection inside control flow, which removes a false warning.
  • script elements are stripped regardless of namespace. Angular already removes <script> from templates; the fix closes the case where the element sat inside another namespace.

Compiler CLI. Constructor parameter properties are no longer marked as inherited, and the extended check for missing directives was optimised.

Angular 22.2.2 tightens template compilation and fixes an afterRenderEffect ordering bug
Angular 22.2.2 tightens template compilation and fixes an afterRenderEffect ordering bug — Dev News Daily

Core. afterRenderEffect sequences registered while render hooks are running are now deferred instead of being processed mid-run. A reserved character is stripped from translations, and the onError handler is untracked so that writing a signal inside it no longer throws.

Forms. setUpValidators no longer crashes when a control is missing.

Who should update. Applications using SVG- or MathML-heavy templates, ng-content projection inside @if/@for blocks, or afterRenderEffect from inside lifecycle hooks are the ones most likely to have met these bugs. For the rest it is a routine patch on the 22.2 line, installable with ng update @angular/core @angular/cli. The release notes do not flag any of the fixes as a security advisory; the script-stripping and prototype-lookup changes are hardening of code paths that handle template content.

Source: Angular 22.2.2 release notes — https://github.com/angular/angular/releases/tag/v22.2.2