1 Features Released with 16.0.0
Browse Other Releases
Top Contributors in 16.0.0
Directory Browser for 16.0.0
We haven't yet finished calculating and confirming the files and directories changed in this release. Please check back soon.
Release Notes Published
<a name="16.0.0"></a>
16.0.0 (2023-05-03)
| Commit | Description |
|---|---|
| remove Angular Compatibility Compiler (ngcc) (#49101) | |
remove deprecated EventManager method addGlobalEventListener (#49645) |
common
compiler
compiler-cli
| Commit | Description |
|---|---|
Add an extended diagnostic for nSkipHydration (#49512) |
|
| Catch FatalDiagnosticError during template type checking (#49527) | |
| optimize NgModule emit for standalone components (#49837) |
core
forms
| Commit | Description |
|---|---|
| Improve typings form (async)Validators (#48679) |
http
migrations
| Commit | Description |
|---|---|
Migration to remove Router guard and resolver interfaces (#49337) |
platform-browser
platform-server
router
service-worker
| Commit | Description |
|---|---|
| add function to provide service worker (#48247) |
Breaking Changes
- Angular Compatibility Compiler (ngcc) has been removed and as a result Angular View Engine libraries will no longer work
- Deprecated
EventManagermethodaddGlobalEventListenerhas been removed as it is not used by Ivy. ### 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
MockPlatformLocationis now provided by default in tests. Existing tests may have behaviors which rely onBrowserPlatformLocationinstead. For example, direct access to thewindow.historyin 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 againTestBed.configureTestingModule({providers: [{provide: PlatformLocation, useClass: BrowserPlatformLocation}]}). The ideal fix would be to update the code to instead be compatible withMockPlatformLocationinstead.- 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.
- Deprecated XhrFactory export from @angular/common/http has been removed. Use XhrFactory from @angular/common instead.
compiler
- * TypeScript 4.8 is no longer supported. ### 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.
zone.jsversions0.11.xand0.12.xare not longer supported.- *
entryComponentshas been deleted from the@NgModuleand@Componentpublic APIs. Any usages can be removed since they weren't doing anyting.ANALYZE_FOR_ENTRY_COMPONENTSinjection 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 on
Object.isequality). 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. RendererType2.stylesno longer accepts a nested arrays.- The
APP_IDtoken value is no longer randomly generated. If you are bootstrapping multiple application on the same page you will need to set to provide theAPP_IDyourself.
bootstrapApplication(ComponentA, {
providers: [
{ provide: APP_ID, useValue: 'app-a' },
// ... other providers ...
]
});
- The
ReflectiveInjectorand related symbols were removed. Please update the code to avoid references to theReflectiveInjectorsymbol. UseInjector.createas a replacement to create an injector instead. - 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.
platform-browser
- The deprecated
BrowserTransferStateModulewas removed, since it's no longer needed. TheTransferStateclass can be injected without providing the module. TheBrowserTransferStateModulewas empty starting from v14 and you can just remove the reference to that module from your applications. ### platform-server - Users that are using SSR with JIT mode will now need to add
import to @angular/compilerbefore bootstrapping the application.
NOTE: this does not effect users using the Angular CLI.
- renderApplication method no longer accepts a root component as first argument. Instead, provide a bootstrapping function that returns a Promise<ApplicationRef>.
Before
ts
const output: string = await renderApplication(RootComponent, options);
Now
ts
const bootstrap = () => bootstrapApplication(RootComponent, appConfig);
const output: string = await renderApplication(bootstrap, options);
- renderModuleFactory has been removed. Use renderModule instead.
router
- The
Scrollevent'srouterEventproperty may also be aNavigationSkippedevent. Previously, it was only aNavigationEndevent. ComponentFactoryResolverhas 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.createComponentwithout the factory resolver.- The
RouterEventtype is no longer present in theEventunion 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). - Tests which mock
ActivatedRouteinstances 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 anActivatedRoutethat 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, therelativeToproperty should be removed. ## Deprecations ### core -
makeStateKey,StateKeyandTransferStateexports have been moved from@angular/platform-browserto@angular/core. Please update the imports.
- import {makeStateKey, StateKey, TransferState} from '@angular/platform-browser';
+ import {makeStateKey, StateKey, TransferState} from '@angular/core';
EnvironmentInjector.runInContextis now deprecated, withrunInInjectionContextfunctioning as a direct replacement:
// Previous method version (deprecated):
envInjector.runInContext(fn);
// New standalone function:
runInInjectionContext(envInjector, fn);
- The
@Directive/@ComponentmoduleIdproperty is now deprecated. It did not have any effect for multiple major versions and will be removed in v17. ### platform-browser BrowserModule.withServerTransitionhas been deprecated.APP_IDshould 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:
ts
imports: [
BrowserModule.withServerTransition({ appId: 'serverApp' }),
...
]
After:
ts
imports: [
BrowserModule,
{ provide: APP_ID, useValue: 'serverApp' },
...
],
- ApplicationConfig has moved, please import ApplicationConfig from @angular/core instead.
platform-server
PlatformConfig.baseUrlandPlatformConfig.useAbsoluteUrlplatform-server config options are deprecated as these were not used.