Packages

@angular/platform-browser-dynamic

22.2.3 · 14 Oct 2026MIT4.2M / 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

22 breaking2 removed1 deprecated37 new6 faster51 fixed4 internal

  • breaking

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

  • breaking

    common: Methods of the PlatformLocation class, namely onPopState and onHashChange, used to return void. Now those methods return functions that can be called to remove event handlers.

  • breaking

    common: The methods of the HttpParams class now accept string | number | boolean 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.

  • breaking

    compiler-cli: Linked libraries no longer generate legacy i18n message ids. Any downstream 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.

  • 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.

Release note

Bug Fixes

  • animations: ensure consistent transition namespace ordering

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

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

  • animations: allow animations on elements in the shadow DOM (#40134) (dad42c8), closes #25672

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

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

  • bazel: update build tooling for latest changes in rules_nodejs

  • bazel: update type castings for JSON.parse usage

  • benchpress: update type castings for JSON.parse usage

  • common: add right ContentType for boolean values with HttpClient request body

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

  • common: viewport scroller not finding elements inside the shadow DOM (#41644) (c0f5ba3), closes #41470

  • deprecated

    common: temporarily re-export and deprecate XhrFactory

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

  • common: allow number or boolean as http params (#40663) (91cdc11), closes #23856

  • common: avoid mutating context object in NgTemplateOutlet (#40360) (d3705b3), closes #24515

  • compiler: preserve @page rules in encapsulated styles (#41915) (3e365ba), closes #26269

  • compiler: strip scoped selectors from @font-face rules (#41815) (2a11cda), closes #41751

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

  • compiler: non-literal inline templates incorrectly processed in partial compilation

  • compiler: not generating update instructions for ng-template inside alternate namespaces (#41669) (2bcbbda), closes #41308

  • compiler: avoid parsing EmptyExpr with a backwards span

  • compiler: handle case-sensitive CSS custom properties (#41380) (e112e32), closes #41364

  • compiler: include used components during JIT compilation of partial component declaration (#41353) (ff9470b), closes #41104 #41318

  • compiler: support multiple :host-context() selectors (#40494) (07b7af3), closes #19199

  • compiler: update type castings for JSON.parse usage

  • compiler-cli: use '' for the source map URL of indirect templates (#41973) (7a4d980), closes #40854

  • compiler-cli: expose the linker as a Babel plugin

  • compiler-cli: prefer non-aliased exports in reference emitters (#41866) (75bb931), closes #41443 #41277

  • compiler-cli: allow linker to process minified booleans (#41747) (1fb6724), closes #41655

  • compiler-cli: match string indexed partial declarations (#41747) (f885750), closes #41655

  • compiler-cli: update supported range of node versions to only include LTS versions

  • compiler-cli: autocomplete literal types in templates.

  • compiler-cli: do not error with prepocessing if component has no inline styles

  • compiler-cli: ensure the compiler tracks ts.Programs correctly

  • compiler-cli: prevent eliding default imports in incremental recompilations (#41557) (7f16515), closes #41377

  • compiler-cli: resolve rootDirs to absolute (#41359) (3e0fda9), closes #36290

  • compiler-cli: add useInlining option to type check config (#41043) (09aefd2), closes #40963

  • compiler-cli: readConfiguration existing options should override options in tsconfig

  • compiler-cli: extend angularCompilerOptions in tsconfig from node (#40694) (5eb1954), closes #36715

  • compiler-cli: update type castings for JSON.parse usage

  • 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

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

  • elements: update type castings for JSON.parse usage

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

  • http: complete the request on timeout (#39807) (61a0b6d), closes #26453

  • http: emit error on XMLHttpRequest abort event (#40767) (3897265), closes #22324

  • language-service: update supported range of node versions to only include LTS versions

  • language-service: use script versions for incremental compilations

  • language-service: Only provide Angular property completions in templates

  • language-service: Add plugin option to force strictTemplates

  • language-service: use single entry point for Ivy and View Engine

  • localize: relax error to warning for missing target (#41944) (35ceed2), closes #21690

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

  • localize: update type castings for JSON.parse usage

  • ngcc: detect synthesized constructors that have been downleveled using TS 4.2 (#41305) (8d3da56), closes #41298

  • platform-browser: prevent memory leak of style nodes if shadow DOM encapsulation is used (#42005) (d555555), closes #36655

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

  • platform-browser: configure XhrFactory to use BrowserXhr (#41313) (e0028e5), closes #41311

  • platform-browser: update type castings for JSON.parse usage

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

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

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

  • router: Only retrieve stored route when reuse strategy indicates it should reattach (#30263) (a4ff071), closes #23162

  • router: recursively merge empty path matches (#41584) (1179dc8), closes #41481

  • router: fragment can be null (#37336) (b555160), closes #23894 #34197

  • router: update type castings for JSON.parse usage

  • service-worker: update supported range of node versions to only include LTS versions

  • service-worker: update type castings for JSON.parse usage

  • upgrade: preserve $interval.flush when ngMocks is being used

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

Features

  • animations: update supported range of node versions

  • animations: add support for disabling animations through BrowserAnimationsModule.withConfig

  • bazel: update supported range of node versions

  • common: update supported range of node versions

  • common: add historyGo method to Location service

  • common: support ICU standard "stand alone day of week" with DatePipe (#40766) (c56ecab), closes #26922

  • common: implement appendAll() method on HttpParams (#20930) (575a2d1), closes #20798

  • compiler: support nullish coalescing in templates (#41437) (ec27bd4), closes #36528

  • compiler: update supported range of node versions

  • compiler: emit @PURE or @pureOrBreakMyCode annotations in the generated code

  • compiler-cli: mark ability to use partial compilation mode as stable (#41518) (6ba67c6), closes #41496

  • compiler-cli: update supported range of node versions

  • compiler-cli: support transforming component style resources

  • compiler-cli: support producing Closure-specific PURE annotations

  • 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

  • elements: update supported range of node versions

  • forms: update supported range of node versions

  • forms: add emitEvent option for AbstractControl-based class methods (#31031) (4ec045e), closes #29662

  • forms: introduce min and max validators (#39063) (8fb83ea), closes #16352

  • http: introduce HttpContext request context

  • http: expose a list of human-readable http status codes (#23548) (6fe3a1d), closes #23543

  • language-service: implement signature help

  • language-service: update supported range of node versions

  • language-service: add perf tracing to LanguageService

  • language-service: add command for getting components for a template file

  • language-service: Add diagnostics to suggest turning on strict mode

  • language-service: Implement getRenameInfo

  • language-service: initial implementation for findRenameLocations

  • language-service: view template typecheck block

  • localize: update supported range of node versions

  • localize: add scripts to migrate away from legacy message IDs

  • ngcc: support __read helper as used by TypeScript 4.2

  • ngcc: support __spreadArray helper as used by TypeScript 4.2 (#41201) (7b1214e) #40394

  • platform-browser: update supported range of node versions

  • platform-browser-dynamic: update supported range of node versions

  • platform-server: update supported range of node versions

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

  • router: update supported range of node versions

  • router: add migration for ActivatedRouteSnapshot.fragment (#41092) (190fa07), closes #37336

  • router: Add more fine-tuned control in routerLinkActiveOptions (#40303) (6c05c80), closes #13205

  • router: Allow for custom router outlet implementations

  • service-worker: update supported range of node versions

  • upgrade: update supported range of node versions

Performance Improvements

  • common: remove unused methods from DomAdapter

  • compiler: reduce amount of generated code for safe accesses and nullish coalescing (#41563) (9a3b82f), closes #41437 #41491

  • compiler-cli: allow incremental compilation in the presence of redirected source files

  • compiler-cli: cache results of absoluteFromSourceFile

  • 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.

  • breaking

    common: Methods of the PlatformLocation class, namely onPopState and onHashChange,
    used to return void. Now those methods return functions that can be called
    to remove event handlers.

  • breaking

    common: The methods of the HttpParams class now accept string | number | boolean
    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.

  • breaking

    compiler-cli: Linked libraries no longer generate legacy i18n message ids. Any downstream
    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

    forms: The emitEvent option was added to the following FormArray and FormGroup methods:

  • 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.

  • breaking

    forms: Previously min and max attributes defined on the <input type="number">
    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.

  • breaking

    platform-browser: XhrFactory has been moved from @angular/common/http to @angular/common.

Before

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

After

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

    router: Strict null checks will report on fragment potentially being null.
    Migration path: add null check.

  • breaking

    router: The type of the RouterLinkActive.routerLinkActiveOptions input was
    expanded to allow more fine-tuned control. Code that previously read
    this property may need to be updated to account for the new type.