38449 Commits

Author SHA1 Message Date
Kam d0a748cc1b 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.
2026-09-09 16:26:08 +02:00
Andrew Scott 094bce9e3d fix(router): determine blocking state solely by resource loading status
Previously, blocking router resources waited on hasValueOrResolved(), which checked whether the resource already had a value. This caused blocking resources with initial values (e.g. defaultValue), streamed early emissions, or existing values during route reloads to resolve prematurely while still in a loading state.

This change updates the blocking resolution check to be solely determined by !underlyingRes.isLoading().
2026-09-09 16:25:24 +02:00
Jaime Burgos 8afd85c6d7 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.
2026-09-09 16:24:37 +02:00
Kristiyan Kostadinov 9b80d4ce9e 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.
2026-09-09 16:23:57 +02:00
SkyZeroZx 9021e275d1 docs: use code block headers for filenames
Move filename comments into headers to keep examples focused on code.
2026-09-09 16:23:09 +02:00
Kam 8037e4ac08 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.
2026-09-09 16:22:32 +02:00
Shuaib Hasan Akib f53b3b6e95 docs: add CommonModule guidance to AI best practices
Clarifies that CommonModule should not be imported wholesale when narrower imports can be used instead.
2026-09-09 16:21:53 +02:00
Kam 4043800ef2 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.
2026-09-09 16:21:14 +02:00
Kam d3ccf5ca82 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.
2026-09-09 16:20:10 +02:00
Angular Robot a959ceda76 build: update pnpm to v12
See associated pull request for more information.
2026-09-09 16:19:17 +02:00
Kam 93f17e0bdf 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.
2026-09-09 16:18:39 +02:00
Shuaib Hasan Akib e80c91b262 docs: render the unsupported version range as an alert 2026-09-09 16:17:46 +02:00
Shuaib Hasan Akib 1bc7e3c2c3 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.
2026-09-09 16:17:04 +02:00
SkyZeroZx 49a797f510 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.
2026-09-09 16:16:28 +02:00
Kam b7d432794e 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.
2026-09-09 16:15:52 +02:00
Kam b0cda277da 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.
2026-09-09 16:15:14 +02:00
Kam d3b0bb1d8c 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.
2026-09-09 16:14:23 +02:00
SkyZeroZx c235ecef8a 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.
2026-09-09 16:13:08 +02:00
Kam 0bdbbcf4a8 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.
2026-09-09 16:12:18 +02:00
Kristiyan Kostadinov 77e2a2a85c refactor(core): expose onDestroy in DirectiveFixture
Exposes the `onDestroy` method from the host component in `DirectiveFixture`. We need this for harnesses in the CDK.
2026-09-09 16:11:33 +02:00
Kam d6d51a0ef8 test(devtools): run the orphaned app component spec
`app.component.spec.ts` has been in the tree since the initial DevTools commit
in 2020, but no revision of `shell-browser/src/app/BUILD.bazel` has ever listed
it, and that file has no globs. Two of the three specs in the directory are
wired up; this one has never run.

It could not run as written. The setup declared `AppComponent` and imported
`RouterModule.forRoot([])`, neither of which applies now that the component is
standalone and injects `MessageBus` and `DEEP_LINK_INSTANCE_ID`.

It now stubs the `chrome.devtools` surface that `ngOnInit` reads and covers
both lifecycle hooks: the listeners registered on init, the two performance
track emits, the three guards on the deep link listener, and the listeners
removed on destroy.

Follow-up to #70570, which fixed the same problem in ng-devtools-backend.
2026-09-09 16:11:01 +02:00
hawkgs 635ef1bd80 refactor(devtools): contain hydration overlays functionality on the be
Move the refresh mechanism of the hydration overlays to the backend,
delegating only the feature toggling to the frontend.
2026-09-09 16:10:25 +02:00
Kam 0029c3ba5a 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.
2026-09-09 16:09:49 +02:00
SkyZeroZx 5afdd98de1 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.
2026-09-09 15:59:01 +02:00
arturovt bd9b45b5cc feat(core): allow reading Injector from a view or content query
Queries could already read `ElementRef`, `TemplateRef` and
`ViewContainerRef` from a matched node via the `read` option, but not the
node injector. Getting it required a helper directive on the element.

`{read: Injector}` now returns the node injector of the matched element,
so a component can resolve tokens as they are seen from that element. This
is useful when wrapping third-party components that project templates and
expect directives inside those templates to inject the host component.

Works for `@ViewChild`/`@ContentChild` and the signal-based
`viewChild`/`contentChild`.

Fixes #47760
2026-09-09 15:57:32 +02:00
Matthieu Riegler d470afa8b2 refactor(platform-server): ensure error boundaries work with ssr/hydration (#70463)
Added some tests to ensure error boundaries work with SSR and hydration.

PR Close #70463
2026-09-09 15:56:05 +02:00
Alex Rickabaugh f4a5650ed9 feat(language-service): add support for @boundary blocks (#70463)
Add support for the new `@boundary` and `@error` control flow blocks in the Angular Language Service.

This includes:
- Updating outlining spans to handle boundary blocks correctly.
- Adding classification visitor methods for semantic tokens.
- Adding template target visitor methods for navigation and hover support.
- Updating the TextMate grammar to recognize `@boundary` and the `when` clause.

PR Close #70463
2026-09-09 15:56:05 +02:00
Alex Rickabaugh f7597cb7d9 refactor(compiler): template type-checking support for @boundary (#70463)
Add support for `@boundary` blocks in the template type-checking pipeline.

PR Close #70463
2026-09-09 15:56:05 +02:00
Alex Rickabaugh 54ed62d240 refactor(core): implement @boundary runtime primitives and AST nodes (#70463)
Add the runtime primitives `ɵɵboundaryCreate` and `ɵɵboundaryUpdate` to
the core instructions, which handle synchronous view destruction and
provide the `ON_ERROR` interceptor hooks.

Also include the initial compiler AST representations for the new syntax
including the Lexer tokenization and HTML Parser integration. This lays
the foundational structure for `@boundary` prior to code generation.

Co-authored-by: Matthieu Riegler <kyro38@gmail.com>

PR Close #70463
2026-09-09 15:56:05 +02:00
Alex Rickabaugh f6afb807c1 feat(core): add ErrorBoundary programmatic APIs (#70463)
Implement error interception during refreshView and provide onError callback options in ViewContainerRef for programmatic rendering and encapsulation of boundary errors.

PR Close #70463
2026-09-09 15:56:05 +02:00
Matthieu Riegler f0a271c7bd 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
2026-09-09 15:54:09 +02:00
arturovt 8227e5cf6d 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
2026-09-09 15:53:28 +02:00
Angular Robot 9a58353b1b build: update cross-repo angular dependencies
See associated pull request for more information.
2026-09-04 07:52:21 -07:00
SkyZeroZx 063eda2db2 test(core): replace act with actAsync
Replaces the custom `act` helper function with the standardized `actAsync` utility
2026-09-04 07:48:11 -07:00
SkyZeroZx 318fefad30 test(forms): Add utility functions and update test files to use them
Moves common helper functions into a shared test utility to reduce duplication.
2026-09-04 07:48:11 -07:00
Kam 3dfc855381 test(devtools): run the orphaned supported-apis spec
`supported-apis.spec.ts` was added in #60585, in a commit that also edited the
`ts_test_library` three lines below the `srcs` it was left out of. No revision
of that BUILD file has ever listed it, so it has not run since March 2025. The
target goes from 12 specs to 14.

Wiring it up alone would not have worked. Every `*IsSupported` helper calls
`ngDebugClient()`, which throws when `window.ng` is undefined, and the old
`expect(supported).toBeTruthy()` set no `ng` at all. It now stubs `ng` and
checks the flag set and that each flag tracks its own debug API.

`ng-debug-api.spec.ts` adds an `[ng-version]` root and did not remove it, which
`getAppRoots()` then picks up in the other file under jasmine's random
ordering, so it now clears the DOM in its own `afterEach`.

`glob` matches the sibling `directive-forest/component-tree` target and keeps
the next spec in this directory from being dropped the same way.
2026-09-04 07:46:46 -07:00
Kam 3481b15167 docs: correct filename labels on code examples
Four labels name a different file than the block loads: three tabs on the
animations guide say `leave.*` but load `leave-parent.*` (`leave.*` is a
separate example shown earlier on the page), and one block in the reactive
forms section says `actor-form-template.component.html` but loads
`actor-form-reactive.component.html`.

The other three leak the `.1`/`.2` variant suffix, which every other
numbered-variant header in adev strips.

https://angular.dev/guide/animations
https://angular.dev/guide/legacy-animations/reusable-animations
https://angular.dev/guide/forms/form-validation
2026-09-04 07:46:12 -07:00
Lazizbek Ergashev 70756b506c fix(core): apply SkipSelf to only the starting node in embedded views
The node-by-node walk used to resolve a token through an embedded view
injector forces the `Self` flag on every node injector lookup. Combined
with `SkipSelf`, that lookup can never match, so every node between the
injection point and the view boundary was skipped and the token was
resolved from the custom injector instead of the nearest parent node.

Clear `SkipSelf` once the starting node has been checked, so only that
node is skipped. This also makes the strip at the embedded view injector
redundant.

Fixes #70547
2026-09-04 07:43:55 -07:00
Angular Robot bae170d535 build: update bazel dependencies
See associated pull request for more information.
2026-09-04 07:27:27 -07:00
Kam 26afa313f3 fix(docs-infra): correct example viewer tab state and line numbering
Five more defects in the example viewer, following #70508.

The DOM was queried before Angular rendered it. `setCodeLinesVisibility()`
walks the rendered lines but ran synchronously on tab change, so it measured
the outgoing tab and the incoming file showed in full. The selected tab was
also lost when the code block was hidden and reshown, because the recreated
tab group had no `[selectedIndex]` while `snippetCode` survived, leaving the
strip and the code disagreeing.

`expandable` was computed once at startup by counting hidden DOM nodes, so a
collapsed tab offered no way to expand it, and recomputing that count on tab
change would drop the control whenever the block was expanded, since nothing
is hidden then. Both paths now share one rule: a file is expandable when it
has a `visibleLinesRange` and either the block is expanded or the range
actually hides lines, so a range that covers its whole file still gets no
inert control.

Array indices were also mixed with 1-based line numbers: the gap check tested
`index - 1` for the preceding line, drawing a `...` separator inside
contiguous ranges, and the gutter tested `index` while the code tested
`index + 1`, shifting every line number by one.

Five new specs cover these, using the comma-separated range format the
pipeline emits; each fails with its fix reverted. The tab label also moves
from 0.8125rem to 0.875rem to match the code beside it.
2026-09-04 07:26:24 -07:00
Andrew Scott 74c1716cef refactor(compiler-cli): index pipes in template expressions
Update the template indexer to discover and record pipes used in template expressions.

This associates template pipe identifiers with their target pipe class declarations, enabling indexers and language tooling to properly resolve and cross-reference pipes.
2026-09-04 07:13:50 -07:00
Andrew Scott 3064f3f1dc feat(router): expose router resources in public API
Router resources integrate the Angular router with the Signals Resource API, allowing route-level data fetching during navigation transitions.
2026-09-04 07:10:49 -07:00
Andrew Scott caeab598c9 refactor(compiler): emit any as type argument for ɵɵInjectableDeclaration
The static `ɵprov` field emitted on `@Injectable()` classes uses `ɵɵInjectableDeclaration<T>`.
When a subclass extends a generic `@Injectable()` base class with contravariant parameters
(such as callback/transformer methods depending on generic type parameters), TypeScript's
static side inheritance check (`typeof Sub extends typeof Super`) fails with `TS2417` because
`ɵɵInjectableDeclaration<Sub>` is not assignable to `ɵɵInjectableDeclaration<Super<any>>`.

Using `any` (`o.DYNAMIC_TYPE`) in `createInjectableType` avoids strict variance checks on
static inheritance for internal Ivy definitions and aligns with other Ivy declaration types.
2026-09-04 07:05:23 -07:00
Angular Robot 98960556a6 build: update mcp-b webmcp dependencies to v5
See associated pull request for more information.
2026-09-04 07:04:49 -07:00
Matthew Beck 81c3f3a6aa release: cut the v22.2.0-next.5 release v22.2.0-next.5 2026-09-02 19:40:50 -07:00
Matthew Beck e4b8822c43 docs: release notes for the v22.1.5 release 2026-09-02 19:37:23 -07:00
Matthew Beck 502fa130aa fix(docs-infra): ignore external links when mapping navigation items to routes
When navigation items contain external URLs (e.g. https:// links for documentation or third-party resources), mapNavigationItemsToRoutes previously registered them as Angular Router route definitions. In recent versions of @angular/build, the static prerender worker asserts that discovered routes do not return empty content during SSG prerendering, causing production builds and CI adev-deploy to fail on these routes.

This change filters out external links in mapNavigationItemsToRoutes so only valid internal application paths are registered as Angular routes.
2026-09-02 19:07:15 -07:00
SkyZeroZx 69c87301aa fix(vscode-extension): prevent JSDoc link provider injection
Treat link targets as file paths so crafted documentation cannot select arbitrary VS Code resource providers.

Fixes https://github.com/angular/angular/issues/70512
2026-09-02 16:06:55 -07:00
arturovt 58d536bc83 fix(core): don't fail NgModule checks for a pipe that extends a base class
When an abstract base class has something like a lifecycle hook, Angular
compiles it as a directive with no selector. If a pipe extends that base
class, the pipe picks up the base class's directive definition through
normal class inheritance.

The NgModule dev-mode checks then got confused by that inherited
definition and reported the pipe as a broken directive:

  - "Directive SomePipe has no selector, please add it!"
  - or, if the base class was a default (standalone) abstract directive,
    "SomePipe is marked as standalone and can't be declared..."

Both only happened in tests (TestBed), not when running the app.

Now the selector check and the standalone check both look at the pipe's
own definition and ignore a directive definition that only came from a
base class.

Fixes #36427
2026-09-02 16:06:12 -07:00
SkyZeroZx 7168bed663 fix(core): validate SVG animation attributes outside the SVG namespace
Make the SVG animation security context depend on the tag name instead of the namespace the element was created in. An animation element declared outside an `<svg>` is created in the HTML namespace, but still animates once it ends up inside an SVG subtree, so to and `attributeName` bindings were reaching the DOM unvalidated.

Fixes  #70490
2026-09-02 16:05:47 -07:00