38330 Commits

Author SHA1 Message Date
SkyZeroZx 16c80643c7 test(core): reduce fakeAsync usage in animation tests
Use async/await in animation acceptance tests and share the animation frame helper. Remove the obsolete fakeAsync frame utility and its Bazel dependency.

(cherry picked from commit c60c41e29a)
2026-09-13 21:20:28 +00:00
Angular Robot 85090453c3 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-09-11 15:41:50 -07:00
Shuaib Hasan Akib 376b71ea1c docs(forms): document what required() considers empty
The `required()` validator treats `null`, `undefined`, `''`, `false` and `NaN` as empty, but the API
docs never defined "empty" at all and the validation guide listed only `null` and `''`.

(cherry picked from commit 467b37b4b4)
2026-09-11 22:16:22 +00:00
Kam 4b5571c324 docs: import bootstrapApplication from platform-browser in the CSP example
The `CSP_NONCE` example in the security guide imports `bootstrapApplication`
from `@angular/core`, which does not export it, so copying the snippet fails
with "has no exported member named 'bootstrapApplication'". It is exported from
`@angular/platform-browser`, which is where every other example in the docs
imports it from.

Keep `CSP_NONCE` on `@angular/core` and import `bootstrapApplication` from
`@angular/platform-browser`.

(cherry picked from commit c097c0144c)
2026-09-11 20:12:34 +00:00
Joey Perrott 66d6e81db2 ci: stop passing preview gating inputs to adev preview build
The Googler check moved out of `pack-and-upload-artifact` and into the
pull request labeling action, which runs in a privileged
`pull_request_target` context where secrets are available. The build job
runs on `pull_request` and never receives secrets, so it no longer needs
`angular-robot-key` or `triggering-label`, and the `bypassed_for_forks`
placeholder can go away. Bumps the dev-infra pins to pick up that change.

(cherry picked from commit 1b7dcc854a)
2026-09-11 20:12:04 +00:00
Kam c4bd3e2c30 docs: fix the broken housing location template in the first-app tutorial
Step 11 of the first-app tutorial ships a `housing-location.ts` whose heading
reads `{{ housingLocatio()).name }}`, a misspelled property followed by an
extra parenthesis, so the step's source fails to compile with a template
parser error. Step 10 reuses this directory as its answer.

It came in with #61686, which migrated the tutorial to signal inputs. Use
`housingLocation().name`, matching the rest of the template and every other
step.

(cherry picked from commit d0ed76c1d6)
2026-09-11 17:59:42 +00:00
Kam 17d6c1bf0e fix(docs-infra): raise SSR fetch limit so the menubar guide prerenders
The aria menubar guide content is 2.9 MB, over the 2 MiB
maxResponseBodySize set in #69379. The fetch fails during prerender,
the navigation error handler redirects to /404, and the prerendered
page is saved as that redirect. Opening /guide/aria/menubar directly
or refreshing it lands on the 404 page.

Raise the limit to 4 MiB. The combobox guide was also within 27 KB of
the old limit.

(cherry picked from commit 01d091bf9c)
2026-09-11 17:42:40 +00:00
Kam 8f6b040da2 fix(docs-infra): match card grid row gap to column gap
The `:not(.docs-card-container) .docs-card` selector was meant to give
standalone cards a vertical margin, but no element has the
docs-card-container class, so it matched every card. Cards in a grid
without a header picked up the 1rem margin on top of the 1.25rem grid
gap, leaving rows 52px apart while columns are 20px apart (for example on
/reference/migrations, /guide/i18n and /roadmap).

Apply the margin only to cards that are not direct children of a card
grid.

(cherry picked from commit b9cbc5fbbe)
2026-09-11 17:41:56 +00:00
Andrew Scott 8a837f6c34 Revert "fix(compiler): wrap @for collection expression before appending non-null assertion"
This reverts commit ed8f16c078.

This caused a breakage in TGP because the changes (correctly) produced new
diagnostics on ` @for (a of (x | async) || []; track a) {` x is `any`. This
results in `<any> | async` which produces `unknown | null` and then the `@if`
finally narrows this down to `{}` which isn't iteratable.

(cherry picked from commit 37ca679192)
2026-09-11 17:05:19 +00:00
Angular Robot 23e5d3090a build: update pnpm to v11.26.0
See associated pull request for more information.
2026-09-10 16:26:59 -07:00
Angular Robot 0194634a3a build: update pnpm/action-setup action to v6.1.0
See associated pull request for more information.
2026-09-10 16:20:24 -07:00
Matthieu Riegler fd8412c364 test(core): fix view injector integration spec
Restore ChangeDetectionStrategy.OnPush that was removed in a previous commit, causing tests to fail due to ExpressionChangedAfterItHasBeenCheckedError.

(cherry picked from commit ae33a5f55e)
2026-09-10 23:17:57 +00:00
Kam 14d6999cd7 docs(forms): close the unterminated code fences in the compatForm docs
Two of the three `compatForm` overloads open a fenced code block in their
`@example` and never close it. The fence then runs to the end of the tag, so the
API renderer emits a plain `<pre><code>` block for those two instead of a
highlighted one.

The result is that on the compatForm API page the first overload's example is
syntax highlighted while the other two, which contain identical code, render as
flat unstyled text.

Rebuilding //adev/src/assets:content with and without this change alters 1 of
1565 pages. That page goes from 6 highlighted and 2 plain code blocks to 8
highlighted and none plain.

(cherry picked from commit b9fb456971)
2026-09-10 14:53:47 -07:00
Matthieu Riegler 66de56beb9 refactor(compiler-cli): relax nullish coalescing non nullable diagnostics on indexed access
When noUncheckedIndexedAccess is not enabled, indexed accesses do not include undefined in the type. This relaxes the check for nullish coalescing similarly to optional chaining. Fixes #70655

fixes #70655

(cherry picked from commit 9090a758be)
2026-09-10 14:31:27 -07:00
SkyZeroZx 0e641241fb test(core): remove redundant change detection configuration
OnPush is now the default change detection strategy, so the explicit test and example configuration is no longer needed.

(cherry picked from commit 9e5ae4b710)
2026-09-10 14:30:36 -07:00
SkyZeroZx e0e1f5f952 docs(router): update scroll restoration example
Uses modern dependency injection and signal-based change detection in the custom scroll restoration example.

(cherry picked from commit 4380e683d8)
2026-09-10 14:30:36 -07:00
SkyZeroZx a205de99ba test(router): remove redundant change detection configuration
OnPush is now the default change detection strategy, so the explicit test configuration is no longer needed.

(cherry picked from commit a958d7fe30)
2026-09-10 14:30:35 -07:00
Kam 4d6d886ff6 fix(docs-infra): escape the code example header
`buildHeaderElement` interpolated the header into a string that is then parsed
as HTML, so markup in a header became an element instead of text. The ten
captions on https://angular.dev/guide/i18n/translation-files read
`messages.fr.xlf ()`, having turned `(<trans-unit>)` into an empty element.

These are the only two headers in the guides containing markup.

(cherry picked from commit 9073469416)
2026-09-10 14:29:15 -07:00
Kam f9654aa297 fix(docs-infra): restore the xlf regions on the i18n guides
#65848 renamed `messages.fr.xlf.html` to `messages.fr.xlf` and, in the same
lines, reverted `region=` back to `visibleRegion=`, undoing #65530 from two
weeks earlier. `visibleRegion` is not read by the tokenizer, and `xlf` is not
in `REGION_MATCHERS`, so both halves of the snippet handling broke at once.

Since then https://angular.dev/guide/i18n/translation-files has shown the same
78 line file ten times where the prose describes single `<trans-unit>`
elements, and https://angular.dev/guide/i18n/manage-marked-text three times,
each carrying the `#docregion` scaffolding into the rendered code.

Mapping `xlf` to the html matcher also cleans up
https://angular.dev/guide/i18n/example, which renders the whole file on purpose
but leaked 27 marker lines into it.

`docs-code.spec.mts` already loads this fixture but only asserted the block
existed, so it stayed green throughout. It now also asserts no marker survives.

(cherry picked from commit 61b353ebee)
2026-09-10 14:29:15 -07:00
Andrew Scott 5e632b639f fix(compiler): wrap @for collection expression before appending non-null assertion
When generating type check blocks for `@for` loops, a non-null assertion is appended to the collection expression. If the collection expression is a compound expression (e.g. binary or logical operations like a && b), the lack of outer parentheses caused the ! to bind only to the rightmost operand (a && b!), leading to typecheck errors such as TS2532.

This wraps the expression via .wrapForTypeChecker() before appending !.

(cherry picked from commit 14dbbf9b68)
2026-09-10 13:22:56 -07:00
Andrew Scott 1905dc6b25 release: bump VSCode extension version to 22.1.1 (#70666) vsix-22.1.1 2026-09-10 11:37:30 -07:00
Kam da8dac62a7 fix(docs-infra): highlight home page code for the resolved theme
`CodeBlock` picked `github-light` only when the theme was exactly `light`, but
`Theme` also has `auto`, the value for anyone who has not opened the theme
menu, and `theme()` is `null` during prerendering. Both fell to `github-dark`,
so the samples in the Signals, Control Flow and Deferrable Views tabs on
https://angular.dev rendered on a dark slab inside a light page.

Resolve the theme in `ThemeManager`, which already owns the `auto` translation.
`resolvedTheme` returns `light` when `theme()` is `null`, which happens only
during prerendering, so `window` is never read. The device scheme moves into a
signal so `auto` also reacts to OS scheme changes.

(cherry picked from commit 8576f161ae)
2026-09-09 22:27:29 +02:00
SkyZeroZx 023d172dcc test(core): reduce fakeAsync usage in tests
Use async/await where needed. Remove unused dependencies.

(cherry picked from commit 947f3ffaef)
2026-09-09 22:26:34 +02:00
Edu ec48c8305c fix(core): return null when getDirectiveMetadata is called with null or undefined
Safely return null instead of throwing an unhandled TypeError when getDirectiveMetadata is called with a falsy directive or component instance.

(cherry picked from commit cea6896a0f)
2026-09-09 22:26:06 +02:00
Edu a4a8573a75 fix(devtools): safely handle foreign root elements in feature detection
Prevent Angular DevTools from crashing when elements matching [ng-version] in the DOM do not belong to the host application (such as third-party custom elements or browser extensions). ng.getComponent returns null for these elements, which previously caused ng.getDirectiveMetadata to throw.

(cherry picked from commit ef09d108f2)
2026-09-09 22:26:05 +02:00
Kristiyan Kostadinov 356adf7491 release: cut the v22.1.6 release v22.1.6 2026-09-09 22:10:21 +02:00
Angular Robot 05a05f5965 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-09-09 16:29:41 +02:00
Alan Agius d20a379583 fix(platform-server): avoid sourcemap corruption during domino path substitution
The substitution regex `\./(.+)/third_party/domino/bundled-domino` was used to rewrite the relative execroot path emitted by Rollup for the domino external import into `../third_party/domino/bundled-domino.mjs`.

However, `ng_package` runs `text_replace` across all generated package files, including `.map` files which are serialized on a single line. The `\./` pattern unintentionally matched the `./` inside `"../../"` in the `sources` array, and the greedy `.+` wildcard matched across the rest of `sources` and the `"sourcesContent": [` declaration up to the domino import within the first source file's content. This corrupted `init.mjs.map` and `_server-chunk.mjs.map` by destroying `sourcesContent` and populating `sources` with raw file contents.

This commit updates the substitution regex to use a negative lookbehind `(?<!\.)` to prevent matching `../` sequences, and restricts the path characters to valid filesystem path characters `[a-zA-Z0-9_./-]+` rather than `.+`.

Fixes #70625

(cherry picked from commit bc3a6cda5d)
2026-09-09 16:27:23 +02:00
Kam dac2fb249d docs(animations): stop the query() usage notes truncating at a code sample
The `query()` usage notes contain this code sample:

    query(':self, .record:enter, .record:leave, @subTrigger', [...])

TypeScript's JSDoc parser treats whitespace followed by `@subTrigger` as the
start of a new tag, even inside a fenced code block. The extraction ends up with
a 145 character `@usageNotes` cut off mid-sample and a phantom `@subTrigger` tag
holding the remaining 2453 characters, which the renderer discards.

The result is that https://angular.dev/api/animations/query ends mid-line inside
that code block. The "Entering and Leaving Elements" and "Usage Example"
sections never render, and the two links pointing at the first of them, one in
the same JSDoc and one in guide/animations/complex-sequences, both dead-end.

Move the `@` token to the front of the selector so it follows a quote rather
than a space. Order within a comma separated selector list is irrelevant, and
the sample's own prose describes it as a set of tokens merged into one string.

The rendered page grows from 7109 to 21269 bytes and gains the
`entering-and-leaving-elements` and `usage-example` anchors. Rebuilding
//adev/src/assets:content with and without the change alters 1 of 1565 pages.

(cherry picked from commit d0a748cc1b)
2026-09-09 16:26:13 +02:00
Jaime Burgos 5dabf81bdf test(forms): migrate integration tests to zoneless scheduling
Use whenStable instead of manual change detection so integration tests exercise scheduled rendering. Await asynchronous callbacks and remove redundant timer waits to keep assertions within the test lifecycle.

(cherry picked from commit 8afd85c6d7)
2026-09-09 16:24:43 +02:00
Kristiyan Kostadinov cbb8702143 fix(compiler): namespace @property declarations
The `@property` atrule allows users to define custom CSS variables. These changes update the compiler to account for when namespacing variables.

(cherry picked from commit 9b80d4ce9e)
2026-09-09 16:24:02 +02:00
SkyZeroZx 046c16d4a3 docs: use code block headers for filenames
Move filename comments into headers to keep examples focused on code.

(cherry picked from commit 9021e275d1)
2026-09-09 16:23:14 +02:00
Kam da5761acc6 docs(docs-infra): correct stale paths and routes in the tutorials README
The tutorials README documents how tutorial content, routes and the shared
common project are laid out, and several of those statements no longer match
the pipeline.

Links: eight links were written as `/src/content/...`. GitHub rewrites a
root-relative markdown link to `/<owner>/<repo>/blob/<branch>/<path>`, so they
resolved to `angular/angular/blob/main/src/content/...` and returned 404. They
now use the repo-root path, matching the convention already used in
`adev/src/app/editor/README.md`.

Routes: the step examples claimed the number prefix is dropped, giving
`/tutorials/learn-angular/components-in-angular`. `routes.mts` emits the step
directory name verbatim and uses the number only for ordering, and the
production sitemap lists only the numbered form, so the two examples and the
bullet describing the step URL are corrected.

Common project: `adev/src/content/tutorials/common` was removed in #53511 and
the shared project now lives in `adev/shared-docs/pipeline/tutorials/common`.
The section also documents the per-tutorial `common` directory that
`tutorial_index.mts` applies on top of the shared one, and drops the reference
to `app.module.ts`, which the standalone common project does not have.

Update dependencies: the script covered five of the eight projects that carry
a package-lock.json. `signals/common`, `signal-forms/common` and the shared
common are added; all eight are already updated together by lock file
maintenance.

The README is excluded from `generate_guides`, so no rendered page changes.
Building `//adev/src/content/tutorials/...` with and without this change
produces byte-identical output across all 213 generated files.

(cherry picked from commit 8037e4ac08)
2026-09-09 16:22:38 +02:00
Shuaib Hasan Akib b9e903caf0 docs: add CommonModule guidance to AI best practices
Clarifies that CommonModule should not be imported wholesale when narrower imports can be used instead.

(cherry picked from commit f53b3b6e95)
2026-09-09 16:21:58 +02:00
Kam da5c94debb fix(docs-infra): recognise an alert that follows prose in the same paragraph
`docs-alert` was the only marked extension in the pipeline without a `start`
hook, so marked never cut `inlineText` short at an alert and swallowed any
directive that was not at the start of the inline source. Writing the alert on
its own line without a blank line before it left the literal text in the body.

On https://angular.dev/guide/http/testing two alerts render as boxes and a
third shows as `IMPORTANT:` in the paragraph text. Also affects
https://angular.dev/errors/NG3003 and the first step of the first app tutorial.

The same renderer handles JSDoc, so one API page changes too:
https://angular.dev/api/upgrade/static/downgradeModule has three `NOTE:`
continuation lines inside bullets that now render as alerts.

`docs-video` and `docs-pill` already declare `start` the same way.

(cherry picked from commit 4043800ef2)
2026-09-09 16:21:19 +02:00
Kam 0801547e3e docs: fix the visibleLines range on the ngFor tutorial step
`visibleLines="26-131"` is not valid JSON, so `expandRangeStringValues` threw
and returned an empty list. The rendered attribute was empty, and the viewer
treats that as no range at all, so no ExampleViewer was created:
https://angular.dev/tutorials/first-app/08-ngFor showed all 128 lines of
`home.ts` with no collapse and no expand control, including the `@for` block
the reader has not written yet.

The file is 128 lines and the property this step adds ends at 127. The sibling
snippet on the same page already uses the `[start,end]` form.

(cherry picked from commit d3ccf5ca82)
2026-09-09 16:20:16 +02:00
Kam 179245b049 docs: fix the docregion marker in the apache config example
The marker was written `# docregion`, but the hash matcher expects
`# #docregion`, one hash for the comment and one for the marker. It was not
recognised, so it was never stripped and rendered as the first line of the
Apache config on https://angular.dev/guide/i18n/deploy.

The sibling `nginx.conf`, shown on the same page, already has the correct form.

(cherry picked from commit 93f17e0bdf)
2026-09-09 16:18:44 +02:00
Shuaib Hasan Akib 3e2627e720 docs: render the unsupported version range as an alert
(cherry picked from commit e80c91b262)
2026-09-09 16:17:51 +02:00
Shuaib Hasan Akib 6da6d7af65 refactor(core): use native Promise.withResolvers() in remaining tests
Replaces the remaining hand-rolled deferred promise implementations
with the native `Promise.withResolvers()` API and removes the now
unused helper and import.

Follow-up to #69739.

(cherry picked from commit 1bc7e3c2c3)
2026-09-09 16:17:09 +02:00
SkyZeroZx e3fb44d8fb test(core): remove redundant change detection configuration
OnPush is now the default change detection strategy, so the explicit test configuration is no longer needed.

Updates outdated Bazel test targets to use the zoneless configuration.

(cherry picked from commit 49a797f510)
2026-09-09 16:16:34 +02:00
Kam fd032a2ce6 fix(docs-infra): keep an explicit theme choice when the OS scheme changes
`watchPreferredColorScheme` applied the OS scheme unconditionally, while
`setTheme`, `loadThemePreference` and the bootstrap script in index.html all
only follow it for `auto`. Choosing Light and then letting the OS switch to
dark repainted the site dark while the theme menu still reported Light, until
a reload restored it.

(cherry picked from commit b7d432794e)
2026-09-09 16:15:57 +02:00
Kam 9d6bd9a4e4 refactor(docs-infra): validate api/cdk and api/aria links
`isKnownRoute` exempted both families behind TODOs waiting on route extraction
for those packages. That extraction had already landed when the TODOs were
written in #66254: cdk pages since #60853 and aria pages since the cross-repo
workflow. `defined-routes.json` carries 70 `api/cdk` and 39 `api/aria` routes
today, and all 45 such link targets in the guides resolve, so the build stays
green without the exemptions.

The gap was not theoretical. `guide/aria/select.md` and
`guide/aria/multiselect.md` linked `api/cdk/overlay/CdkConnectedOverlay`, which
has never been a route, and it shipped as a 404 for six months. Link validation
landed four months into that and said nothing, because of this exemption. It
took a user filing #68914 and an outside contributor fixing it in #68915.

Pointing an existing `api/cdk` link at a symbol that does not exist passes the
build today and fails it with this change.

(cherry picked from commit b0cda277da)
2026-09-09 16:15:19 +02:00
Kam 8a1162dc2d test(docs-infra): run the orphaned shared-docs pipes specs
`relative-link.pipe.spec.ts` and `is-active-navigation-item.pipe.spec.ts`
arrived with this package's BUILD file in #57132, but no test target came with
them and `lib` excludes `**/*.spec.ts`, so nothing has ever compiled them.
`bazel query` reports both as not declared in the package.

They pass unmodified. `getRelativeUrl` has no other coverage in the repo, and
both pipes are used by the search dialog, the navigation list and the not
found page.

(cherry picked from commit d3b0bb1d8c)
2026-09-09 16:14:29 +02:00
SkyZeroZx 3bc03fa6a9 test(forms): remove redundant change detection configuration
OnPush is now the default change detection strategy, and tests run zoneless by default, so the explicit configuration is no longer needed.

(cherry picked from commit c235ecef8a)
2026-09-09 16:13:14 +02:00
Kam 237be1f494 fix(docs-infra): only read a deprecation version from the start of the tag
`getTagSinceVersion` matched `\d+(\.\d+)?` anywhere in the tag comment. That
works for `@developerPreview`, `@experimental` and `@stable`, whose comment is
only a version, but `@deprecated` also carries a message, so any number in the
prose won. https://angular.dev/api/common/getLocaleCurrencyCode reads
"deprecated since v4217", taken from "a map of locale to ISO 4217 currency
codes", and eighteen sibling pages take v18 from the "i18n" in "relying on the
`Intl` API for i18n".

Anchoring the match, and allowing the `since`/`from`/`as of` prefixes the
comments use, leaves all seventy-nine correctly versioned comments untouched.
`generate_manifest` carries its own copy of the regex, so the API list badges
had the same values.

Those `@angular/common` comments never stated a version, so they now say `18.0`
explicitly, the release `d34c033902` (#54483) first shipped in, matching the
`@deprecated 18.0` already on `FormatWidth` in the same file. Nine tags in that
file had no version at all and were showing no badge; they are from the same
commit and now say `18.0` too.

(cherry picked from commit 0bdbbcf4a8)
2026-09-09 16:12:24 +02:00
Kam 1fd8e7e85f docs: use a supported alert level for the cross-field validation note
`WARNING:` is not an `AlertSeverityLevel`, so the paragraph rendered as plain
body text on https://angular.dev/guide/forms/signals/cross-field-logic while
the three other alerts on the page rendered normally. `CRITICAL` is the level
kitchen-sink.md defines for warning the reader off a footgun.

The five `@Component({/* ... */})` collapses are the formatter's. The file has
drifted out of prettier since it landed, and `ng-dev format changed --check`
checks whole changed files.

(cherry picked from commit 0029c3ba5a)
2026-09-09 16:09:54 +02:00
SkyZeroZx cc4c2ce413 fix(docs-infra): remove space after decorator symbol
Handle the separate whitespace token emitted by Shiki when a decorator name is linked to its API reference.

(cherry picked from commit 5afdd98de1)
2026-09-09 15:59:06 +02:00
Matthieu Riegler aea121e532 fix(compiler-cli): do not flag callable objects with zero parameters in uninvoked track function check
In `@for` blocks, tracking callable objects by reference (e.g. signal forms `FieldTree`, signals, or custom callable objects) is a valid pattern when tracking by object identity. Previously, `UninvokedTrackFunctionCheck` (NG8115) flagged any property read whose type has call signatures, regardless of whether the target was an actual track function expecting arguments or a method reference.

This commit updates `UninvokedTrackFunctionCheck` to only emit a diagnostic when the target expression has call signatures that declare parameters (functions/methods expecting arguments like `(item)` or `(index, item)`) or is a method declaration. Callable objects without parameters accessed as properties are now recognized as tracked values and not flagged as uninvoked track functions.

Fixes #70207

(cherry picked from commit f0a271c7bd)
2026-09-09 15:54:16 +02:00
arturovt 95c01e9cde fix(router): keep detached route subtree contexts isolated and intact
When a route is detached for `RouteReuseStrategy`, its component and child
`RouterOutlet`s stay alive and keep referencing the `ChildrenOutletContexts`
they were created with. `detachAndStoreRouteSubtree` used to call
`onOutletDeactivated()`, which swaps that object's Map for an empty one, so
after re-attaching, the inner outlet and the router read from two different
context trees and deeper child routes (e.g. an `edit` route under a reused
list) never rendered.

Now, on detach: take the child contexts map as-is (destruction still calls
`onOutletDeactivated()` to prune) and give the `OutletContext` a fresh
`ChildrenOutletContexts`. This keeps the detached component rendering from
its stored map once re-attached, and prevents whatever activates next in
the same parent outlet (e.g. a sibling tab) from mutating or wiping that
stored map.

Fixes #57285

(cherry picked from commit 8227e5cf6d)
2026-09-09 15:53:34 +02:00
SkyZeroZx ef48630a14 test(core): replace act with actAsync
Replaces the custom `act` helper function with the standardized `actAsync` utility

(cherry picked from commit 063eda2db2)
2026-09-04 07:48:16 -07:00