Skip to content

Commit 109eb88

Browse files
jelbournalxhub
authored andcommitted
docs: add v16 update guide (#50073)
PR Close #50073
1 parent 08b664d commit 109eb88

5 files changed

Lines changed: 177 additions & 5 deletions

File tree

.pullapprove.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,8 @@ groups:
952952
'aio/content/guide/update-to-latest-version.md',
953953
'aio/content/guide/versions.md',
954954
'aio/content/guide/update-to-version-14.md',
955-
'aio/content/guide/update-to-version-15.md'
955+
'aio/content/guide/update-to-version-15.md',
956+
'aio/content/guide/update-to-version-16.md',
956957
])
957958
reviewers:
958959
users:
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Update Angular to v16
2+
3+
<!-- NOTE to writers: When creating the topic for the next version, -->
4+
<!-- remember to update the redirect link in angular/aio/firebase.json -->
5+
<!-- To update the redirect link in angular/aio/firebase.json: -->
6+
<!-- 1. Search for the entry in firebase.json with "source": "guide/update-to-latest-version" -->
7+
<!-- 2, Update the destination value to refer to the new guide's URL -->
8+
<!-- -->
9+
10+
This topic provides information about updating your Angular applications to Angular version 16.
11+
12+
For a summary of this information and the step-by-step procedure to update your Angular application
13+
to v16, see the [Angular Update Guide](https://update.angular.io).
14+
15+
The information in the [Angular Update Guide](https://update.angular.io) and this topic is
16+
summarized from these changelogs:
17+
18+
* [angular/angular changelog](https://github.com/angular/angular/blob/main/CHANGELOG.md)
19+
* [angular/angular-cli changelog](https://github.com/angular/angular-cli/blob/main/CHANGELOG.md)
20+
* [angular/components changelog](https://github.com/angular/components/blob/main/CHANGELOG.md)
21+
22+
Information about updating Angular applications to v15 is archived at
23+
[Update to version 15](/guide/update-to-version-15).
24+
25+
<a id="new-features"></a>
26+
27+
## Feature highlights in Angular v16
28+
29+
For a more comprehensive list of new features, see the
30+
[Angular blog post on the update to v16](https://blog.angular.io).
31+
32+
<!-- markdownLint-disable MD001 -->
33+
34+
#### Angular Signals developer preview
35+
36+
This release includes the first developer preview of Angular's new reactivity primitives: `signal`,
37+
`computed`, and `effect`. See the [signals guide](/guide/signals) for details and the
38+
[Angular Signals RFC](https://github.com/angular/angular/discussions/49685) for more background.
39+
40+
#### Enhanced hydration developer preview
41+
42+
Previously, when Angular bootstrapped on a page that was server-side rendered or compile-time
43+
pre-rendered, the framework would discard any existing DOM nodes and re-render from scratch. With
44+
v16's enhanced hydration support, you can opt into Angular reusing these existing DOM nodes. This
45+
developer preview feature can improve page load performance in many scenarios. See the full
46+
[hydration guide](/guide/hydration) for details.
47+
48+
### Faster builds with the esbuild developer preview
49+
50+
v16 brings you the developer preview of Angular CLI's new builders based on
51+
[esbuild](https://esbuild.github.io). This new architecture can significantly improve build times in
52+
many scenarios. This preview additionally includes integration with [Vite](https://vitejs.dev)
53+
powering the CLI's development server.
54+
55+
You can try this new build setup by updating your `angular.json`:
56+
57+
```json
58+
"architect": {
59+
"build": {
60+
"builder": "@angular-devkit/build-angular:browser-esbuild",
61+
```
62+
63+
### Standalone component migration and scaffolding
64+
65+
To support developers transitioning their apps to standalone APIs, Angular v16 includes migration
66+
schematics and a standalone migration guide. These tools dramatically reduce the effort required to
67+
move your code to standalone components, directives, and pipes. Visit the
68+
[standalone migration guide](/guide/standalone-migration) for details.
69+
70+
You can now also generate new Angular applications with standalone components by running:
71+
72+
```sh
73+
ng new --standalone
74+
```
75+
76+
### Required inputs
77+
78+
You can now mark component and directive inputs as _required_:
79+
80+
```typescript
81+
export class ColorPicker {
82+
@Input({ required: true }) defaultColor: string;
83+
}
84+
```
85+
86+
If a template includes a component without specifying all of its required inputs, Angular reports
87+
an error at build time.
88+
89+
<a id="breaking-changes"></a>
90+
91+
## Highlighted breaking changes in Angular v16
92+
93+
For a comprehensive list of breaking changes, see the full changelogs on GitHub.
94+
95+
<a id="v16-bc-01"></a>
96+
97+
### Angular v16 requires node.js version v16 or v18
98+
99+
Angular requires node.js v16 or v18. [PR #47730](https://github.com/angular/angular/pull/49255)
100+
101+
See [Version compatibility](/guide/versions) for full version compatibility details.
102+
103+
<a id="v16-bc-02"></a>
104+
105+
### Angular v16 requires TypeScript version 4.9 or later
106+
107+
Angular v16 no longer supports TypeScript versions older than 4.9. [PR #49155](https://github.com/angular/angular/pull/49155)
108+
109+
See [Version compatibility](/guide/versions) for full version compatibility details.
110+
111+
<a id="v16-bc-03"></a>
112+
113+
### Angular Compatibility Compiler (ngcc) has been removed
114+
115+
The Angular Compatibility Compiler (ngcc) was a build tool that facilitated compatibility between
116+
Angular's previous compiler and rendering architecture (View Engine) and its new architecture (Ivy).
117+
118+
View Engine was removed in Angular v13, and v16 finally removes ngcc. As a result, Angular
119+
libraries built with View Engine cannot be used in Angular v16+.
120+
121+
<a id="v16-bc-04"></a>
122+
123+
#### Angular Package Format changes
124+
125+
The Angular Package Format (APF) has been updated
126+
with the following changes:
127+
128+
* Flattened ESM 2015 (FESM2015) outputs have been removed.
129+
* EcmaScript 2020 outputs have been updated to EcmaScript 2022 (including the flattened output).
130+
131+
See [Angular Package Format](/guide/angular-package-format) for background.
132+
133+
<a id="v16-bc-06"></a>
134+
135+
#### `ReflectiveInjector` has been removed
136+
137+
The ReflectiveInjector and related symbols were removed. Please update the code to avoid references
138+
to the ReflectiveInjector symbol. Use `Injector.create` to create an injector instead.
139+
140+
<a id="v16-bc-07"></a>
141+
142+
#### Updated behavior for `Router.createUrlTree`
143+
144+
Tests which mock `ActivatedRoute` instances may need to be adjusted because Router.createUrlTree now
145+
does the right thing in more scenarios. This means that tests with invalid/incomplete ActivatedRoute
146+
mocks may behave differently than before. Additionally, tests may now navigate to a real URL where
147+
before they would navigate to the root. Ensure that tests provide expected routes to match. There is
148+
rarely production impact, but it has been found that relative navigations when using
149+
an `ActivatedRoute` that does not appear in the current router state were effectively ignored in the
150+
past. By creating the correct URLs, this sometimes resulted in different navigation behavior in the
151+
application. Most often, this happens when attempting to create a navigation that only updates query
152+
params using an empty command array, for
153+
example `router.navigate([], {relativeTo: route, queryParams: newQueryParams})`. In this case,
154+
the `relativeTo` property should be removed.
155+
156+
<a id="deprecations"></a>
157+
158+
## Deprecations highlights in Angular v16
159+
160+
These APIs remain available in v16, but may be removed in future versions as described by Angular's
161+
[deprecation practices](/guide/releases#deprecation-practices).
162+
163+
To maintain the reliability of your Angular application, always update your application as soon as
164+
practicable.
165+
166+
| Removed | Replacement | Details |
167+
|:-------------------------------------------------------------------------------------|:------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
168+
| <a id="v16-dp-01"></a>Class and `InjectionToken` router guards and resolvers | See details | Class and `InjectionToken` guards and resolvers are deprecated. Instead, write guards as plain JavaScript functions and inject dependencies with `inject` from `@angular/core`.<br>[PR #47924](https://github.com/angular/angular/pull/47924) |
169+
| <a id="v16-dp-02"></a>The `ripple` properties of several Angular Material components | None | The `ripple` property of `MatButton`, `MatCheckbox`, `MatChip` is deprecated. This change moves ripples to being a private implementation detail of the components. |
170+
171+
@reviewed 2023-05-03

aio/content/navigation.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@
887887
"tooltip": "Angular release practices, updating, and upgrading.",
888888
"children": [
889889
{
890-
"url": "guide/update-to-version-15",
890+
"url": "guide/update-to-version-16",
891891
"title": "Update Angular to the latest version",
892892
"tooltip": "Update your Angular application to the latest version."
893893
},
@@ -1422,4 +1422,4 @@
14221422
]
14231423
}
14241424
]
1425-
}
1425+
}

aio/firebase.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
// The destination value must be updated with each new major version.
8888
// When changing this value, be sure to update or add the corresponding
8989
// test in angular/aio/tests/deployment/shared/URLS_TO_REDIRECT.txt
90-
{"type": 301, "source": "/guide/update-to-latest-version", "destination": "/guide/update-to-version-15"},
90+
{"type": 301, "source": "/guide/update-to-latest-version", "destination": "/guide/update-to-version-16"},
9191

9292
// Renaming of Getting Started topics
9393
{"type": 301, "source": "/start/data", "destination": "/start/start-data"},

aio/tests/deployment/shared/URLS_TO_REDIRECT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
/guide/service-worker-configref --> /guide/service-worker-config
215215
/guide/setup --> /guide/setup-local
216216
/guide/setup-systemjs-anatomy --> /guide/file-structure
217-
/guide/update-to-latest-version --> /guide/update-to-version-15
217+
/guide/update-to-latest-version --> /guide/update-to-version-16
218218
/guide/updating-to-version-10 --> https://v10.angular.io/guide/updating-to-version-10
219219
/guide/updating-to-version-11 --> https://v11.angular.io/guide/updating-to-version-11
220220
/guide/updating-to-version-12 --> https://v12.angular.io/guide/updating-to-version-12

0 commit comments

Comments
 (0)