Packages

@angular/platform-server

22.2.6 · 12 Nov 2026MIT1M / weekRepositoryHomepagenpmAtom feed

Your version

12.0.0

major12 May 2021Where it was published

12.2.17 is the newest release of 12.x.

In short

14 breaking2 removed1 deprecated9 new4 faster14 fixed2 internal

  • Breaking

    Minified UMD bundles are no longer included in the distributed NPM packages.

  • Breaking

    core: Angular no longer maintains support for node v10

  • Breaking

    core: Previously the ng.getDirectives function threw an error in case a given DOM node had no Angular context associated with it (for example if a function was called for a DOM element outside of an Angular app). This behavior was inconsistent with other debugging utilities under ng namespace, which handled this situation without raising an exception. Now calling the ng.getDirectives function for such DOM nodes would result in an empty array returned from that function.

  • Breaking

    core: Switching default of emitDistinctChangesOnlyDefaultValue which changes the default behavior and may cause some applications which rely on the incorrect behavior to fail.

  • Breaking

    core: The type of the APP_INITIALIZER token has been changed to more accurately reflect the types of return values that are handled by Angular. Previously, each initializer callback was typed to return any, this is now Promise<unknown> | Observable<unknown> | void. In the unlikely event that your application uses the Injector.get or TestBed.inject API to inject the APP_INITIALIZER token, you may need to update the code to account for the stricter type.

  • Breaking

    core: Minimum supported zone.js version is 0.11.4

  • Breaking

    FormGroup.addControl

  • Breaking

    FormGroup.removeControl

Security

11 advisories affect 12.0.0; 20.3.33 fixes them

6 more

Release note

The section about @angular/platform-server of a note shared by several packages.

Bug Fixes

  • animations: cleanup DOM elements when the root view is removed

  • animations: cleanup DOM elements when the root view is removed

  • Deprecated

    common: temporarily re-export and deprecate XhrFactory

  • common: cleanup location change listeners when the root view is removed (#40867) (38524c4), closes #31546

  • core: do not retain dynamically compiled components and modules (#42003) (1449c5c), closes #19997

  • core: invoke profiler around ngOnDestroy lifecycle hooks

  • core: AsyncPipe now compatible with RxJS 7

  • core: handle multiple i18n attributes with expression bindings (#41882) (73c6c64), closes #41869

  • core: update supported range of node versions to only include LTS versions

  • core: detect synthesized constructors that have been downleveled using TS 4.2 (#41305) (274dc15), closes #41298

  • core: Switch emitDistinctChangesOnlyDefaultValue to true

  • core: remove duplicated EMPTY_OBJ constant

  • core: remove duplicated EMPTY_ARRAY constant

  • core: allow EmbeddedViewRef context to be updated (#40360) (a3e1719), closes #24515

  • core: make DefaultIterableDiffer keep the order of duplicates (#23941) (a826926), closes #23815

  • core: NgZone coaleascing options should trigger onStable correctly

  • platform-server: update supported range of node versions to only include LTS versions

Features

  • core: introduce getDirectiveMetadata global debugging utility

  • core: update supported range of node versions

  • core: support forwardRef in providedIn of Injectable declaration (#41426) (f7c294e), closes #41205

  • core: add migration for XhrFactory import

  • Removed

    core: drop support for TypeScript 4.0 and 4.1

  • core: support TypeScript 4.2

  • core: manually annotate de-sugarred core tree-shakable providers with @pureOrBreakMyCode

  • core: more precise type for APP_INITIALIZER token (#40986) (ca721c2), closes #40729

  • Removed

    core: drop support for zone.js 0.10.x (#40823) (aaf9b31), closes angular/angular-cli#20034

  • core: support APP_INITIALIZER work with observable (#33222) (ca17ac5), closes #15088

  • platform-server: update supported range of node versions

  • platform-server: allow shimming the global env sooner (#40559) (43ecf8a), closes #24551 #39950 #39950

Performance Improvements

  • common: remove unused methods from DomAdapter

  • core: minor improvements to listener instructions

  • core: avoid storing LView in ngContext (#41358) (990067a), closes #41047

  • core: optimize getDirectives

Breaking changes

  • Breaking

    Minified UMD bundles are no longer included in the distributed NPM packages.

  • Breaking

    animations: DOM elements are now correctly removed when the root view is removed.
    If you are using SSR and use the app's HTML for rendering, you will need
    to ensure that you save the HTML to a variable before destorying the
    app.
    It is also possible that tests could be accidentally relying on the old behavior by
    trying to find an element that was not removed in a previous test. If
    this is the case, the failing tests should be updated to ensure they
    have proper setup code which initializes elements they rely on.
    used to return void. Now those methods return functions that can be called
    to remove event handlers.
    instead of string for the value of a parameter.
    If you extended this class in your application,
    you'll have to update the signatures of your methods to reflect these changes.
    application that provides translations for these messages, will need to
    migrate their message ids using the localize-migrate command line tool.

  • Breaking

    core: Angular no longer maintains support for node v10

  • Breaking

    core: Previously the ng.getDirectives function threw an error in case a
    given DOM node had no Angular context associated with it (for example
    if a function was called for a DOM element outside of an Angular app).
    This behavior was inconsistent with other debugging utilities under ng
    namespace, which handled this situation without raising an exception.
    Now calling the ng.getDirectives function for such DOM nodes would
    result in an empty array returned from that function.

  • Breaking

    core: Switching default of emitDistinctChangesOnlyDefaultValue
    which changes the default behavior and may cause some applications which
    rely on the incorrect behavior to fail.

emitDistinctChangesOnly flag has also been deprecated and will be
removed in a future major release.

The previous implementation would fire changes QueryList.changes.subscribe
whenever the QueryList was recomputed. This resulted in an artificially
high number of change notifications, as it is possible that recomputing
QueryList results in the same list. When the QueryList gets recomputed
is an implementation detail, and it should not be the thing that determines
how often change event should fire.

Unfortunately, fixing the behavior outright caused too many existing
applications to fail. For this reason, Angular considers this fix a
breaking fix and has introduced a flag in @ContentChildren and
@ViewChildren, that controls the behavior.

export class QueryCompWithStrictChangeEmitParent {
  @ContentChildren('foo', {
    // This option is the new default with this change.
    emitDistinctChangesOnly: true,
  })
  foos!: QueryList<any>;
}

For backward compatibility before v12
emitDistinctChangesOnlyDefaultValue was set to false. This change
changes the default to true.

  • Breaking

    core: The type of the APP_INITIALIZER token has been changed to more accurately
    reflect the types of return values that are handled by Angular. Previously,
    each initializer callback was typed to return any, this is now
    Promise<unknown> | Observable<unknown> | void. In the unlikely event that
    your application uses the Injector.get or TestBed.inject API to inject
    the APP_INITIALIZER token, you may need to update the code to account for
    the stricter type.

Additionally, TypeScript may report the TS2742 error if the APP_INITIALIZER
token is used in an expression of which its inferred type has to be emitted
into a .d.ts file. To workaround this, an explicit type annotation is needed,
which would typically be Provider or Provider.

  • Breaking

    core: Minimum supported zone.js version is 0.11.4

  • Breaking

    FormGroup.addControl

  • Breaking

    FormGroup.removeControl

  • Breaking

    FormGroup.setControl

  • Breaking

    FormArray.push

  • Breaking

    FormArray.insert

  • Breaking

    FormArray.removeAt

  • Breaking

    FormArray.setControl

  • Breaking

    FormArray.clear

If your app has custom classes that extend FormArray or FormGroup classes and override the
above-mentioned methods, you may need to update your implementation to take the new options into
account and make sure that overrides are compatible from a types perspective.
were ignored by Forms module. Now presence of these attributes would
trigger min/max validation logic (in case formControl, formControlName
or ngModel directives are also present on a given input) and
corresponding form control status would reflect that.

Before

import {XhrFactory} from '@angular/common/http';

After

import {XhrFactory} from '@angular/common';

Migration path: add null check.
expanded to allow more fine-tuned control. Code that previously read
this property may need to be updated to account for the new type.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.