v13.0.0
13.0.0 (2021-11-03)
Breaking Changes
common
- The behavior of the
SpyLocationused by theRouterTestingModulehas changed
to match the behavior of browsers. It no longer emits a 'popstate' event
whenLocation.gois called. In addition,simulateHashChangenow
triggers both ahashchangeand apopstateevent.
Tests which uselocation.goand expect the changes to be picked up by
theRoutershould likely change tosimulateHashChangeinstead.
Each test is different in what it attempts to assert so there is no
single change that works for all tests. Each test using theSpyLocationto
simulate browser URL changes should be evaluated on a case-by-case basis.
core
-
TypeScript versions older than 4.4.2 are no longer supported.
-
NodeJS versions older than
v12.20.0are no longer
supported due to the Angular packages using the NodeJS package exports
feature with subpath patterns. -
The
WrappedValueclass can no longer be imported from@angular/core,
which may result in compile errors or failures at runtime if outdated
libraries are used that are still usingWrappedValue. The usage of
WrappedValueshould be removed as no replacement is available.
forms
- A new type called
FormControlStatushas been introduced, which is a union of all possible status strings for form controls.AbstractControl.statushas been narrowed fromstringtoFormControlStatus, andstatusChangeshas been narrowed fromObservable<any>toObservable<FormControlStatus>. Most applications should consume the new types seamlessly. Any breakage caused by this change is likely due to one of the following two problems: (1) the app is comparingAbstractControl.statusagainst a string which is not a valid status; or, (2) the app is usingstatusChangesevents as if they were something other than strings.
router
-
The default url serializer would previously drop
everything after and including a question mark in query parameters. That
is, for a navigation to/path?q=hello?&other=123, the query
params would be parsed to just{q: 'hello'}. This is
incorrect because the URI spec allows for question mark characers in
query data. This change will now correctly parse the params for the
above example to be{v: 'hello?', other: '123'}. -
Previously
nullandundefinedinputs forrouterLinkwere
equaivalent to empty string and there was no way to disable the link's
navigation.
In addition, thehrefis changed from a propertyHostBinding()to an
attribute binding (HostBinding('attr.href')). The effect of this
change is thatDebugElement.properties['href']will now return the
hrefvalue returned by the native element which will be the full URL
rather than the internal value of theRouterLinkhrefproperty. -
The router will no longer replace the browser URL when a new navigation
cancels an ongoing navigation. This often causes URL flicker and was
only in place to support some AngularJS hybrid applications. Hybrid
applications which rely on thenavigationIdbeing present on initial
navigations that were handled by the Angular router should instead
subscribe toNavigationCancelevents and perform the
location.replaceStatethemselves to addnavigationIdto the Router
state.
In addition, tests which asserturlChangeson theSpyLocationmay
need to be adjusted to account for thereplaceStatewhich is no longer
triggered. -
It is no longer possible to use
Route.loadChildrenusing a string
value. The following supporting classes were removed from
@angular/core: -
NgModuleFactoryLoader -
SystemJsNgModuleFactoryLoader
The @angular/router package no longer exports these symbols:
SpyNgModuleFactoryLoaderDeprecatedLoadChildren
The signature of the setupTestingRouter function from
@angular/core/testing has been changed to drop its NgModuleFactoryLoader
parameter, as an argument for that parameter can no longer be created.
service-worker
- The return type of
SwUpdate#activateUpdateandSwUpdate#checkForUpdatechanged toPromise<boolean>.
Although unlikely, it is possible that this change will cause TypeScript type-checking to fail in
some cases. If necessary, update your types to account for the new
return type.
Deprecations
- The
renderModuleFactorysymbol in@angular/platform-serveris no longer necessary as of Angular v13.
The renderModuleFactory calls can be replaced with renderModule.
service-worker
- The
SwUpdate#activatedobservable is deprecated.
The SwUpdate#activated observable only emits values as a direct response to calling
SwUpdate#activateUpdate() and was only useful for determining whether the call resulted in an
update or not. Now, the return value of SwUpdate#activateUpdate() can be used to determine the
outcome of the operation and therefore using SwUpdate#activated does not offer any benefit.
- The
SwUpdate#availalbeobservable is deprecated.
The new SwUpdate#versionUpdates observable provides the same information and more. Therefore, it
is possible to rebuild the same behavior as SwUpdate#availalbe using the events emitted by
SwUpdate#versionUpdates and filtering for VersionReadyEvent events.
As a result, the SwUpdate#availalbe observable is now redundant.
| Commit | Description |
|---|---|
deprecate ViewEngine-based renderModuleFactory (#43757) |
bazel
| Commit | Description |
|---|---|
add strict_templates and experimental_extended_template_diagnostics to ng_module() rule (#43582) |
|
allow for custom conditions to be set in ng_package targets (#43764) |
|
| create transition for enabling partial compilation (#43431) | |
expose esm2020 and es2020 conditions in APF package exports (#43740) |
|
implement partial compilation APF v13 for ng_package rule (#43431) |
|
| switch prodmode output to ES2020 (#43431) | |
wire up partial compilation build setting in ng_module (#43431) |
|
| construct a manifest file even when warnings are emitted (#43582) | |
| ngc-wrapped should not rely on linker for external workspaces (#43690) |
common
| Commit | Description |
|---|---|
| add injection token for default date pipe timezone (#43611) | |
| synchronise location mock behavior with the navigators (#41730) |
compiler
| Commit | Description |
|---|---|
| do not error if $any is used inside a listener (#43866) |
compiler-cli
| Commit | Description |
|---|---|
| inline resources when generating class metadata calls (#43178) | |
| handle nullable expressions correctly in the nullish coalescing extended template diagnostic (#43572) | |
| not evaluating new signature for __spreadArray (#43618) | |
updates ngc to pass the build when only warnings are emitted (#43673) |
core
| Commit | Description |
|---|---|
add createNgModuleRef function to create NgModuleRef based on NgModule class (#43580) |
|
add getNgModuleById function to retrieve loaded NgModules by id (#43580) |
|
| add migration to opt out existing apps from new test module teardown behavior (#43353) | |
| Add migration to update empty routerLinks in templates (#43176) | |
| add support for Types in ViewContainerRef.createComponent (#43022) | |
| drop support for TypeScript 4.2 and 4.3 (#43642) | |
| enable test module teardown by default (#43353) | |
| support TypeScript 4.4 (#43281) | |
| update node version support range to support v16 (#43740) | |
| avoid duplicating comments in TestBed teardown migration (#43776) | |
| don't rethrow errors if test teardown has been disabled (#43635) | |
| incorrect signature for initTestEnvironment (#43615) | |
support InjectFlags argument in NodeInjector.get() (#41592) |
|
remove support for the deprecated WrappedValue (#43507) |
elements
| Commit | Description |
|---|---|
remove ng-add schematic (#43975) |
|
remove incorrect @angular/platform-browser peer dependency (#43975) |
forms
| Commit | Description |
|---|---|
allow disabling min/max validators dynamically (by setting the value to null) (#42978) |
|
| Make Form Statuses use stricter types. (#42952) |
language-service
| Commit | Description |
|---|---|
| Add method for retrieving the component template at the cursor location (#43208) | |
| auto-apply optional chaining on nullable symbol (#42995) | |
| provide snippets for attribute (#43590) | |
exclude the SafePropertyRead when applying the optional chaining (#43321) |
migrations
| Commit | Description |
|---|---|
| account for CRLF characters in template migrations (#44013) | |
| apply individual expression edits to preserve newline characters (#43519) | |
| Ensure routerLink migration doesn't update unrelated files (#43519) | |
| migration failed finding tsconfig file (#43343) | |
| prevent migrations from updating external templates multiple times (#44013) |
router
| Commit | Description |
|---|---|
| emit activate/deactivate events when an outlet gets attached/detached (#43333) | |
| new output that would notify when link is activated (#43280) | |
| Option to correctly restore history on failed navigation (#43289) | |
| Allow question marks in query param values (#31187) | |
| Do not modify parts of URL excluded from with 'eager' updates (#43421) | |
| fix Router's public API for canceledNavigationResolution (#43842) | |
| null/undefined routerLink should disable navigation (#43087) | |
Only trigger router navigation on popstate events from Location subscription (#43328) |
|
| Prevent URL flicker when new navigations cancel ongoing ones (#43496) | |
| reuse route strategy fix (#43791) | |
remove support for loadChildren string syntax (#43591) |
service-worker
| Commit | Description |
|---|---|
SwUpdate#activeUpdate and SwUpdate#checkForUpdate should have a meaningful outcome (#43668) |
|
| expose more version update events (#43668) |
Special Thanks
Ahmed Ayed, Alan Agius, Alex Rickabaugh, Andrew Kushnir, Andrew Scott, Bjarki, Charles Lyding, Dmitrij Kuba, Doug Parker, Dylan Hunn, George Kalpakas, Jessica Janiuk, Jochen Kraushaar, Joe Martin (Crowdstaffing), Joey Perrott, Jon Rimmer, JoostK, Kristiyan Kostadinov, Maximilian Köller, Paul Gschwendtner, Pei Wang, Pete Bacon Darwin, Tomasz Domański, Willy Schott, anandtiwary, dario-piotrowicz, iRealNirmal, ivanwonder, krzysztof-grzybek, mgechev and vthinkxie