39001 Commits
Author SHA1 Message Date
Alon Mishne e043658ddb release: cut the v22.2.7 release v22.2.7 2026-11-18 11:14:25 -08:00
Jessica Janiuk 1a2e59b1d7 ci: update dev-infra members
This adds 3 new people to the dev-infra pullapprove group.

(cherry picked from commit 661f5c9193)
2026-11-18 18:27:53 +00:00
Paul Gschwendtner ff0068a117 ci: remove devversion from pullapprove reviewers
Remove `@devversion` from PullApprove review groups and reset the temporary
`users_unavailable` entry as part of repository offboarding.

(cherry picked from commit 9f4c159acd)
2026-11-17 19:07:40 +00:00
arturovt a47f9c581d fix(zone.js): add types condition to subpath exports
Consider the following example:

```ts
if (ngDevMode) {
  await import('zone.js/plugins/task-tracking');
}
```

Under `moduleResolution: "bundler"`, `"node16"` or `"nodenext"` this fails to
type-check:

```
Could not find a declaration file for module 'zone.js/plugins/task-tracking'.
'.../node_modules/zone.js/fesm2015/task-tracking.js' implicitly has an 'any' type.
```

The `exports` map declares `types` only on the root entry, so every subpath
resolves to a bare `.js` file. Legacy `moduleResolution: "node"` ignores
`exports` and finds files by path, which is why nobody hit this until the
newer resolution modes became common.

Prior to this commit there was nothing a subpath `types` condition could
point at, because the package shipped a single declaration file at its root.
With this commit the build emits one declaration next to each bundle, and
every subpath gets a `types` condition. The bundles patch globals and export
nothing, so each declaration is `export {};` and adds no API surface to
maintain.

Legacy `node` resolution does not change. Those subpaths did not resolve
there before this commit either.

(cherry picked from commit d3a3ebf0a0)
2026-11-17 17:33:06 +00:00
Andrew Scott 8bed23246a refactor(core): quote InputMap constraint keys on directive declarations
`getInputsTypeExpression` in `@angular/compiler` emits `'alias'`, `'required'`, and `'isSignal'` as quoted string-literal property signatures in the `InputMap` type argument of `ɵɵDirectiveDeclaration` and `ɵɵComponentDeclaration` on `ɵdir` and `ɵcmp`. However, `ɵɵDirectiveDeclaration` and `ɵɵComponentDeclaration` in `@angular/core` declared those constraint keys as unquoted identifier property signatures (`{alias: string | null; required: boolean; isSignal?: boolean}`).

In standard TypeScript, quoted and unquoted property signatures are structurally identical. When a property-renaming safety pass rewrites unquoted identifier property signatures in `.d.ts` type literals while preserving quoted string-literal keys, the renamed constraint keys on `InputMap` no longer match the quoted `'alias'`, `'required'`, and `'isSignal'` keys emitted on preprocessed `ɵdir` and `ɵcmp` source declarations, failing `TS2344`.

Quote `'alias'`, `'required'`, and `'isSignal'` in the `InputMap` constraint on `ɵɵDirectiveDeclaration` and `ɵɵComponentDeclaration` so the declaration constraints match the quoted keys emitted by `@angular/compiler`.

(cherry picked from commit 9399d67252)
2026-11-16 22:44:52 +00:00
arturovt 490be3e2c2 fix(core): throw NG0512 instead of TypeError when hydration text node is missing
Given this template:

```html
<main>
  <span>{{ value }}</span>
</main>
```

During hydration, Angular looks for the text node that the server rendered
inside the `<span>`. If the HTML from the server was changed and this text
node is missing, dev mode throws a clear NG0500 error. But this check only
runs in dev mode.

Prior to this fix, production continued with the missing text node and failed
on the first update of that binding with a raw error that doesn't say what
went wrong:

```
TypeError: Cannot set properties of null (setting 'nodeValue')
```

With this fix, production throws NG0512 during hydration instead.

Note that static text behaves differently. Nothing ever updates it, so it
hydrated without an error before this fix and left a gap in the DOM. It now
throws as well.

(cherry picked from commit 2a450cbfaa)
2026-11-16 22:12:30 +00:00
Kam 33000bb5ca docs: fix the input setter coercion example in the template type checking guide
The "Input setter coercion" section opened with a signal input that uses
`transform: booleanAttribute`, then said that `<submit-button disabled>`
is a type error under strict templates. With that transform the attribute
form compiles, so the example never showed the problem. The rest of the
section is about an `@Input()` setter typed `boolean`.

Use a plain `boolean` getter and setter in the first example so it
matches the text that follows, update the intro sentence to say the value
is altered in the setter, and remove a duplicated "Consider the following
directive:" line.

(cherry picked from commit 567ae3ed66)
2026-11-16 20:57:37 +00:00
Jeevan Mahesha 0270980bde docs: add guidance against expensive work in templates
AI coding agents using the angular-developer skill were observed calling
plain methods inside @for/@if template expressions, for example
items(count) returning a new array on every check. The skill had no
guidance on this.

Add a short rule to SKILL.md and a section to components.md that
recommends computed(), a pure pipe or a child component for expensive
work that would otherwise re-run on every change detection cycle. Signal
reads and cheap calls stay allowed.

Related to #70132

(cherry picked from commit 09264663af)
2026-11-16 20:57:14 +00:00
MuslumYilmaz 4c65c9b263 docs: describe the automatic Eager migration in the v22 update guide
The v22 step told readers to set `ChangeDetectionStrategy.Eager` by hand,
but `ng update` already adds it to every component without a
`changeDetection` property and replaces the deprecated `Default` with
`Eager`. Say so, cover projects updated without `ng update`, and note when
the explicit `Eager` can be removed again.

(cherry picked from commit 7409c74d06)
2026-11-13 23:47:16 +00:00
Shuaib Hasan Akib 8bf87ae7c7 docs: fix network error description in the HTTP testing guide
With the default fetch backend, network errors are reported as an
`HttpErrorResponse` with status 0 whose `error` is the error thrown by
`fetch`, not a `ProgressEvent`.

(cherry picked from commit 3547cdbdf6)
2026-11-13 23:36:10 +00:00
Shuaib Hasan Akib 818bf54607 fix(forms): format Date min/max for controls with a ControlValueAccessor
When a `[formField]` element also has a ControlValueAccessor, a `Date`
from `minDate()` or `maxDate()` was written to the native `min`/`max`
property with `Date#toString()`, which date inputs ignore. Format it
like the native and custom control paths do.

(cherry picked from commit 189afa9ce5)
2026-11-13 20:11:05 +00:00
Andrew Scott 8f3e1472ee refactor(router): run canMatch guards in root environment injector (g3-only)
Run Route.canMatch guards in the Router's root environment injector rather than the route injector in google3 so that route matching does not depend on route-level providers.

Gated behind `g3-only` / `3p-only` markers so 3p behavior remains unchanged until v23.

(cherry picked from commit 74e7cc94b7)
2026-11-13 19:28:03 +00:00
Shuaib Hasan Akib 2f5f0fab8e docs(forms): fix FormRoot and focus details in the field state guide
`FormRoot` only calls `submit()` for forms created with a `submission`
option, and `focusBoundControl()` on a custom control without a
`focus()` method focuses its host element. Also make the form-level
state example use `FormRoot` with validators so the button does not
reload the page, and avoid `$event.target.value`, which does not
compile with strict templates.

(cherry picked from commit 42f347f7cc)
2026-11-13 18:36:00 +00:00
arturovt 22b7937849 fix(core): throw NG0502 instead of a TypeError when a hydration comment is missing
Consider the following template:

```html
<main>
  @if (show) {
    <span>text</span>
  }
</main>
```

During hydration, Angular looks for the comment node that marks where the
`@if` block (or an `<ng-container>`) is. If the HTML from the server was
changed and this comment is missing, dev mode throws a clear NG0502 error.
But this check only runs in dev mode.

Prior to this fix, production continued with the missing comment and failed
later with a raw error that doesn't say what went wrong:

```
TypeError: Cannot set properties of null (setting '__ngContext__')
```

With this fix, production also throws NG0502.

(cherry picked from commit 551c446d98)
2026-11-12 17:25:56 +00:00
Matthieu Riegler 424c9f4f5c fix(core): suppress hydration warnings in test environments
When running component tests in TestBed, an application may include
provideClientHydration() (e.g. from appConfig.providers) or use
defer blocks with hydrate triggers without hydration providers configured.

In these testing scenarios, there is no serialized server state in
TransferState. As a result, Angular emitted spurious warnings:
- NG0505: warning that client hydration was requested but no serialized info was found.
- NG0508: warning that incremental hydration is not enabled for @defer hydrate triggers.

This commit introduces an internal IS_TESTING token, provided by TestBedCompiler
and BrowserTestingModule, which suppresses these warnings in test environments.

Fixes #62053

(cherry picked from commit 0ce6110471)
2026-11-12 17:03:42 +00:00
Jessica Janiuk dda2d41d94 release: cut the v22.2.6 release v22.2.6 2026-11-11 16:01:25 -08:00
Shuaib Hasan Akib 5b66fb4010 fix(forms): flush debounced descendant values when a field is touched
`markAsTouched()` synchronized a pending debounced value only on the
field it was called on. Its descendants were marked as touched, but
their pending values stayed unsynced.

`submit()` marks the root as touched before running the action, so
submitting with Enter while a debounced child still had focus ran the
action with the child's old value. Clicking a submit button hid the bug,
because the click blurs the input first.

This is a regression from #67453. Before it, `submit()` called the
public `markAsTouched()` on each active field, which flushed it.

Flush each field's pending value right after marking it as touched.
Disabled, hidden and readonly fields still aren't marked as touched, but
unlike before #67453 they are flushed too, so their pending value reaches
the model before the action reads it. Below them only fields that already
exist are visited, since a field that was never created can't have a
pending value.

Tested with new specs in `//packages/forms/signals/test/node:test`. The
specs for descendants, `submit()`, an invalid flushed value, a duration
debounce and sibling fields fail without the fix; another checks that
touching a form doesn't create the fields of a hidden subtree.

Fixes #71149

(cherry picked from commit cf37344a4d)
2026-11-11 22:13:36 +00:00
Travis Adams b9a20dad3e docs: adjust wording; fix code block indentation
(cherry picked from commit 38ca463bef)
2026-11-11 21:49:07 +00:00
Travis Adams 31d82f642a docs: improve sample code; fix snippets
Improve consistency of code across steps; remove unnecessary Home
import; adjust and fix snippets

(cherry picked from commit cabe828227)
2026-11-11 21:49:07 +00:00
Travis Adams b4692f3d2f docs: rename HousingService file
Preserve the service name HousingService, but update the filename to
match what is generated by `ng generate service housingService`

Previously attempted in #70154

(cherry picked from commit 84ab42a173)
2026-11-11 21:49:07 +00:00
Travis Adams 781b4bc2de docs: ensure CLI generates CSS file for component
Adjust tutorial workspace config to ensure that `ng generate component`
creates an accompanying .css file, to match what is expected in the
first-app tutorial. Adjust components in the tutorial to use `styleUrl`,
to match what is generated by `ng generate component`.

(cherry picked from commit b8e4d3e1f8)
2026-11-11 21:49:07 +00:00
Travis Adams 90625706f3 docs: use consistent verb tense in step intros
(cherry picked from commit 5f6b798f4e)
2026-11-11 21:49:07 +00:00
nagahara-naoki 7644d2dc4a fix(http): clean up pending tasks when interceptors throw synchronously
Remove the registered pending task when an interceptor chain throws before
returning an Observable. Preserve the original error for the caller and keep
finalize responsible for completion, Observable errors, and cancellation.

Apply cleanup to both the outer HTTP handler and the legacy interceptor
adapter, since each registers its own task that can otherwise block stability.

Add tests for synchronous errors, Observable errors, completion, and
unsubscribe with both functional and legacy interceptors.

Closes #71953

(cherry picked from commit 818742755c)
2026-11-11 21:17:32 +00:00
Shuaib Hasan Akib 0a5851226e docs: update when the DevTools Transfer State tab is shown
The Transfer State tab no longer has an opt-in setting. It is shown
automatically when the application uses hydration.

(cherry picked from commit 9a1855e058)
2026-11-11 20:27:35 +00:00
Angular Robot 38fdf9ec8c docs: update cross-repo adev docs
Updated Angular adev cross repo docs files.
2026-11-11 11:35:24 -08:00
Shuaib Hasan Akib 99a6a1e69c docs: fix NgModule bootstrap guidance in the NgModules overview
Components in `bootstrap` are not added to the module's declarations.
They must be declared, otherwise JIT throws "is not part of any NgModule".
Add `declarations` to the example and correct the sentence.

(cherry picked from commit 1937b96fa6)
2026-11-11 19:21:08 +00:00
Matthieu Riegler e6be7408f2 test(docs-infra): setup webdriver_test e2e test for adev playground
Add a Bazel `webdriver_test` E2E test for `adev` in `adev/e2e_test` that
verifies the playground boots in WebContainer and renders the default
Angular application in the preview iframe.

Also deduplicate files and directories read by `TypingsLoader` so
WebContainer does not get flooded with thousands of duplicate `.d.ts`
file reads during playground initialization.

(cherry picked from commit ccd3508697)
2026-11-11 19:19:11 +00:00
Matthieu Riegler 596a40061f fix(core): resolve closure and reference retention leaks
Resolves several V8 closure-context and reference retention issues
across `@angular/core`, including isolating closure scopes in
`injectAsync`, `ɵɵboundaryUpdate`, and incremental hydration triggers,
skipping non-`jsaction` elements in event replay stashing, clearing
recovered signal error references, and avoiding retaining the document
reference in `InertDocumentHelper`.

(cherry picked from commit 5f51154197)
2026-11-11 19:12:23 +00:00
Kam 59d5f0d1c4 docs: fix type errors in defining dependency providers snippets
The `LOGGER_FN` example indexes `console` with a `string` level, which
fails under strict TypeScript (TS7053). Narrow the level to
`'log' | 'warn' | 'error'`.

The `DataStore` example declares `data` as `ListItem[]`, a type that is
never defined or imported (TS2304). Use `string[]`, matching the
`LocalDataStore` example earlier in the page.

(cherry picked from commit 9f5a0ceb02)
2026-11-11 18:25:12 +00:00
Shuaib Hasan Akib 0cdae2c67b docs: use the generated vitest-base.config.mts name in the testing guide
`ng generate config vitest` creates `vitest-base.config.mts`, not
`vitest-base.config.ts`.

(cherry picked from commit d5b60537e1)
2026-11-11 17:47:33 +00:00