Angular 16
https://github.com/angular/angular
16.0.0-next.7 (2023-04-05)
Breaking Changes
core
- QueryList.filter now supports type guard functions, which will result in type narrowing. Previously if you used type guard functions, it resulted in no changes to the return type. Now the type would be narrowed, which might require updates to the application code that relied on the old behavior.
- The
ReflectiveInjector
and related symbols were removed. Please update the code to avoid references to theReflectiveInjector
symbol. UseInjector.create
as a replacement to create an injector instead.
platform-browser
- The deprecated
BrowserTransferStateModule
was removed, since it's no longer needed. TheTransferState
class can be injected without providing the module. TheBrowserTransferStateModule
was empty starting from v14 and you can just remove the reference to that module from your applications.
core
http
Commit | Description |
---|---|
allow HttpClient to cache requests (#49509) |
platform-browser
platform-server
Commit | Description |
---|---|
rename provideServerSupport to provideServerRendering (#49678) |
router
Commit | Description |
---|---|
create correct URL relative to path with empty child (#49691) |
Special Thanks
Alan Agius, Alex Rickabaugh, Andrew Kushnir, Andrew Scott, Charles Lyding, Dylan Hunn, Guillaume Weghsteen, Jessica Janiuk, JoostK, Matthieu Riegler, Pawel Kozlowski, Robin Richtsfeld, Sandra Limacher and vikram menon
16.0.0-next.6 (2023-04-03)
Breaking Changes
- Deprecated
EventManager
methodaddGlobalEventListener
has been removed as it is not used by Ivy.
Commit | Description |
---|---|
remove deprecated EventManager method addGlobalEventListener (#49645) |
core
forms
Commit | Description |
---|---|
Improve typings form (async)Validators (#48679) |
router
Commit | Description |
---|---|
Opt-in for binding Router information to component inputs (#49633) |
|
Ensure initial navigation clears current navigation when blocking (#49572) |
Special Thanks
Alan Agius, Alex Rickabaugh, Andrew Kushnir, Andrew Scott, John Manners, Johnny Gérard, Kristiyan Kostadinov, Matthieu Riegler, Pawel Kozlowski, Sarthak Thakkar and Vinit Neogi
16.0.0-next.5 (2023-03-29)
Breaking Changes
bazel
- Several changes to the Angular Package Format (APF)
- Removal of FESM2015
- Replacing ES2020 with ES2022
- Replacing FESM2020 with FESM2022
- Several changes to the Angular Package Format (APF)
- Removal of FESM2015
- Replacing ES2020 with ES2022
- Replacing FESM2020 with FESM2022
common
- If the 'ngTemplateOutletContext' is different from the context, it will result in a compile-time error.
Before the change, the following template was compiling:
interface MyContext {
$implicit: string;
}
@Component({
standalone: true,
imports: [NgTemplateOutlet],
selector: 'person',
template: `
<ng-container
*ngTemplateOutlet="
myTemplateRef;
context: { $implicit: 'test', xxx: 'xxx' }
"></ng-container>
`,
})
export class PersonComponent {
myTemplateRef!: TemplateRef<MyContext>;
}
However, it does not compile now because the 'xxx' property does not exist in 'MyContext', resulting in the error: 'Type '{ $implicit: string; xxx: string; }' is not assignable to type 'MyContext'.'
The solution is either:
- add the 'xxx' property to 'MyContext' with the correct type or
- add '$any(...)' inside the template to make the error disappear. However, adding '$any(...)' does not correct the error but only preserves the previous behavior of the code.
core
-
entryComponents
has been deleted from the@NgModule
and@Component
public APIs. Any usages can be removed since they weren't doing anyting.ANALYZE_FOR_ENTRY_COMPONENTS
injection token has been deleted. Any references can be removed.
- ComponentRef.setInput will only set the input on the
component if it is different from the previous value (based onObject.is
equality). If code relies on the input always being set, it should be
updated to copy objects or wrap primitives in order to ensure the input
value differs from the previous call tosetInput
.
Deprecations
core
makeStateKey
,StateKey
andTransferState
exports have been moved from@angular/platform-browser
to@angular/core
. Please update the imports.
- import {makeStateKey, StateKey, TransferState} from '@angular/platform-browser';
+ import {makeStateKey, StateKey, TransferState} from '@angular/core';
- The
@Directive
/@Component
moduleId
property is now
deprecated. It did not have any effect for multiple major versions and
will be removed in v17.
platform-server
PlatformConfig.baseUrl
andPlatformConfig.useAbsoluteUrl
platform-server config options are deprecated as these were not used.
common
Commit | Description |
---|---|
invalid ImageKit transformation (#49201) | |
strict type checking for ngtemplateoutlet (#48374) |
compiler
Commit | Description |
---|---|
do not unquote CSS values (#49460) | |
handle trailing comma in object literal (#49535) |
compiler-cli
Commit | Description |
---|---|
Add an extended diagnostic for nSkipHydration (#49512) |
core
http
Commit | Description |
---|---|
force macro task creation during HTTP request (#49546) |
migrations
Commit | Description |
---|---|
Migration to remove Router guard and resolver interfaces (#49337) |
platform-browser
Commit | Description |
---|---|
set nonce attribute in a platform compatible way (#49624) |
platform-server
Commit | Description |
---|---|
deprecate useAbsoluteUrl and baseUrl (#49546) |
router
Special Thanks
Alan Agius, Alex Rickabaugh, Andrew Kushnir, Andrew Scott, Asaf Malin, Jan Cabadaj, Jessica Janiuk, JiaLiPassion, Kristiyan Kostadinov, Matthieu Riegler, Paul Gschwendtner, Pawel Kozlowski, Sid, Tano Abeleyra and tomalaforge
16.0.0-next.4 (2023-03-22)
Breaking Changes
platform-server
-
renderApplication
method no longer accepts a root component as first argument. Instead, provide a bootstrapping function that returns aPromise<ApplicationRef>
.Before
const output: string = await renderApplication(RootComponent, options);
Now
const bootstrap = () => bootstrapApplication(RootComponent, appConfig); const output: string = await renderApplication(bootstrap, options);
compiler
Commit | Description |
---|---|
add support for compile-time required inputs (#49453) | |
add support for compile-time required inputs (#49468) |
core
migrations
Commit | Description |
---|---|
preserve trailing commas in code generated by standalone migration (#49533) |
platform-browser
Commit | Description |
---|---|
only add ng-app-id to style on server side (#49465) |
platform-server
Commit | Description |
---|---|
remove renderApplication overload that accepts a component (#49463) |
Special Thanks
Aditya Srinivasan, Alan Agius, Alex Rickabaugh, Andrew Kushnir, Andrew Scott, Jessica Janiuk, Kristiyan Kostadinov, Masaoki Kobayashi, Matthieu Riegler, Paul Gschwendtner, Pawel Kozlowski, Peter Götz, Thomas Pischke, Virginia Dooley and avmaxim
16.0.0-next.3 (2023-03-16)
Breaking Changes
core
-
The
APP_ID
token value is no longer randomly generated. If you are bootstrapping multiple application on the same page you will need to set to provide theAPP_ID
yourself.bootstrapApplication(ComponentA, { providers: [ { provide: APP_ID, useValue: 'app-a' }, // ... other providers ... ] });
router
ComponentFactoryResolver
has been removed from Router APIs.
Component factories are not required to create an instance of a component
dynamically. Passing a factory resolver via resolver argument is no longer needed
and code can instead useViewContainerRef.createComponent
without the
factory resolver.
Deprecations
core
-
EnvironmentInjector.runInContext
is now deprecated, with
runInInjectionContext
functioning as a direct replacement:// Previous method version (deprecated): envInjector.runInContext(fn); // New standalone function: runInInjectionContext(envInjector, fn);
platform-browser
-
BrowserModule.withServerTransition
has been deprecated.APP_ID
should be used instead to set the application ID.
NB: Unless, you render multiple Angular applications on the same page, setting an application ID is not necessary.Before:
imports: [ BrowserModule.withServerTransition({ appId: 'serverApp' }), ... ]
After:
imports: [ BrowserModule, { provide: APP_ID, useValue: 'serverApp' }, ... ],
compiler
Commit | Description |
---|---|
add support for compile-time required inputs (#49304) |
core
Commit | Description |
---|---|
introduce runInInjectionContext and deprecate prior version (#49396) |
|
generate consistent component IDs (#48253) | |
generate a static application ID (#49422) |
platform-browser
Commit | Description |
---|---|
deprecate withServerTransition call (#49422) |
|
reuse server generated component styles (#48253) |
platform-server
Commit | Description |
---|---|
add provideServerSupport function to provide server capabilities to an application (#49380) |
router
Commit | Description |
---|---|
Remove deprecated ComponentFactoryResolver from APIs (#49239) |
service-worker
Commit | Description |
---|---|
add function to provide service worker (#48247) |
Special Thanks
Alan Agius, Alex Rickabaugh, Andrew Kushnir, Andrew Scott, Esteban Gehring, Jessica Janiuk, JiaLiPassion, Julien Saguet, Kristiyan Kostadinov, Matthieu Riegler, Paul Gschwendtner and Virginia Dooley
16.0.0-next.2 (2023-03-08)
Breaking Changes
common
- Deprecated
XhrFactory
export from@angular/common/http
has been removed. UseXhrFactory
from@angular/common
instead.
core
zone.js
versions0.11.x
and0.12.x
are not longer supported.
platform-server
renderModuleFactory
has been removed. UserenderModule
instead.
Deprecations
platform-browser
ApplicationConfig
has moved, please importApplicationConfig
from@angular/core
instead.
common
Commit | Description |
---|---|
remove deprecated XhrFactory export from http entrypoint (#49251) |
compiler
Commit | Description |
---|---|
support multiple configuration files in extends (#49125) |
core
Commit | Description |
---|---|
add mergeApplicationConfig method (#49253) |
|
drop support for zone.js versions <=0.12.0 (#49331) |
migrations
Commit | Description |
---|---|
add protractor support if protractor imports are detected (#49274) |
platform-browser
Commit | Description |
---|---|
KeyEventsPlugin should keep the same behavior (#49330) | |
move ApplicationConfig to core (#49253) |
platform-server
Commit | Description |
---|---|
renderApplication now accepts a bootstrapping method (#49248) |
|
remove deprecated renderModuleFactory (#49247) |
router
Commit | Description |
---|---|
Expose information about the last successful Navigation (#49235) |
Special Thanks
Alan Agius, Andrew Kushnir, Andrew Scott, Dylan Hunn, Jessica Janiuk, JiaLiPassion, Kristiyan Kostadinov, Matthieu Riegler, Paul Gschwendtner, Sai Kartheek Bommisetty and Vinit Neogi
16.0.0-next.1 (2023-03-01)
Breaking Changes
compiler
-
- TypeScript 4.8 is no longer supported.
core
-
Node.js v14 support has been removed
Node.js v14 is planned to be End-of-Life on 2023-04-30. Angular will stop supporting Node.js v14 in Angular v16. Angular v16 will continue to officially support Node.js versions v16 and v18.
router
- Tests which mock
ActivatedRoute
instances may need to be adjusted
because Router.createUrlTree now does the right thing in more
scenarios. This means that tests with invalid/incomplete ActivatedRoute mocks
may behave differently than before. Additionally, tests may now navigate
to a real URL where before they would navigate to the root. Ensure that
tests provide expected routes to match.
There is rarely production impact, but it has been found that relative
navigations when using anActivatedRoute
that does not appear in the
current router state were effectively ignored in the past. By creating
the correct URLs, this sometimes resulted in different navigation
behavior in the application. Most often, this happens when attempting to
create a navigation that only updates query params using an empty
command array, for examplerouter.navigate([], {relativeTo: route, queryParams: newQueryParams})
. In this case, therelativeTo
property
should be removed.
common
Commit | Description |
---|---|
make Location.normalize() return the correct path when the base path contains characters that interfere with regex syntax. (#49181) |
compiler
Commit | Description |
---|---|
drop support for TypeScript 4.8 (#49155) |
compiler-cli
Commit | Description |
---|---|
do not persist component analysis if template/styles are missing (#49184) |
core
Commit | Description |
---|---|
add support for TypeScript 5.0 (#49126) | |
introduce concept of DestroyRef (#49158) | |
update zone.js peerDependencies ranges (#49244) | |
remove Node.js v14 support (#49255) |
migrations
Commit | Description |
---|---|
avoid migrating the same class multiple times in standalone migration (#49245) | |
delete barrel exports in standalone migration (#49176) |
platform-server
Commit | Description |
---|---|
bundle @angular/domino in via esbuild (#49229) |
router
Special Thanks
Alan Agius, Andrew Kushnir, Andrew Scott, Aristeidis Bampakos, Craig Spence, Doug Parker, Iván Navarro, Jessica Janiuk, JiaLiPassion, Joey Perrott, Kristiyan Kostadinov, Matthieu Riegler, Michael Ziluck, Paul Gschwendtner, Pawel Kozlowski, Stephanie Tuerk, Vincent and Virginia Dooley
16.0.0-next.0 (2023-02-22)
Breaking Changes
- Angular Compatibility Compiler (ngcc) has been removed and as a result Angular View Engine libraries will no longer work
common
MockPlatformLocation
is now provided by default in tests.
Existing tests may have behaviors which rely on
BrowserPlatformLocation
instead. For example, direct access to the
window.history
in either the test or the component rather than going
through the Angular APIs (Location.getState()
). The quickest fix is to
update the providers in the test suite to override the provider again
TestBed.configureTestingModule({providers: [{provide: PlatformLocation, useClass: BrowserPlatformLocation}]})
.
The ideal fix would be to update the code to instead be compatible with
MockPlatformLocation
instead.
core
RendererType2.styles
no longer accepts nested arrays.
router
- The
Scroll
event'srouterEvent
property may also be
aNavigationSkipped
event. Previously, it was only aNavigationEnd
event. - The
RouterEvent
type is no longer present in theEvent
union type representing all router event types. If you have code using something likefilter((e: Event): e is RouterEvent => e instanceof RouterEvent)
, you'll need to update it tofilter((e: Event|RouterEvent): e is RouterEvent => e instanceof RouterEvent)
.
Commit | Description |
---|---|
remove Angular Compatibility Compiler (ngcc) (#49101) |
common
Commit | Description |
---|---|
Provide MockPlatformLocation by default in BrowserTestingModule (#49137) |
core
Commit | Description |
---|---|
add Angular Signals to the public API (#49150) | |
change RendererType2.styles to accept only a flat array (#49072) |
router
Commit | Description |
---|---|
Ensure anchor scrolling happens on ignored same URL navigations (#48025) | |
remove RouterEvent from Event union type (#46061) |
Special Thanks
Alan Agius, Alex Rickabaugh, Andrew Kushnir, Andrew Scott, Cédric Exbrayat, Joey Perrott, Mladen Jakovljević and Pawel Kozlowski