38638 Commits
Author SHA1 Message Date
Andrew Scott fb7711f87d release: cut the v22.2.1 release v22.2.1 2026-09-30 11:33:55 -07:00
Andrew Scott b18137ce93 Revert "docs: document reactive forms in child components"
This reverts commit ec5cdd1f7d.
tests are broken

(cherry picked from commit 2ba4cbfcf2)
2026-09-30 17:31:33 +00:00
GabeSilvaDev 2bd20fdecd docs: fix afterRenderEffect phase example in the effect guide
The render phases section said phases are specified by passing an object
with a `phase` property to `afterRender` or `afterNextRender`. `afterRender`
was renamed to `afterEveryRender` and the `phase` option no longer exists;
the example shows the spec object accepted by `afterRenderEffect`.

Also fix `nativeElement` being called as a function in the chart example.

(cherry picked from commit 4fa5ce03f0)
2026-09-30 16:56:51 +00:00
splincode 62c042c1f3 docs: document reactive forms in child components
(cherry picked from commit ec5cdd1f7d)
2026-09-30 16:56:06 +00:00
Kam 78d0648348 docs: add the missing inject import to the inject migration examples
The "After" example for `backwardsCompatibleConstructors` imports only
`Component` while its class body calls `inject(MyService)`. The migration
adds `inject` to the `@angular/core` import itself, so the example never
matched its output. The schematic README has the same gap, and its own
first example references `TOKEN` while importing `DI_TOKEN`.

The same block also carried a markdown-escaped doc comment,
`/\*_ ... _/`, and a property sitting outside the class indentation.
`26fed34e0e` introduced both by running prettier over the page while the
snippets were still `<docs-code>` elements, where `**` reads as emphasis.
`caaa5ec8e6` re-indented five of the six blocks when it converted them to
fenced code, and `3731f07579` restored the escaped comment. Prettier skips
a fence it cannot parse, which is why `6270bba056` normalized every other
block on the page and left this one untouched.

Repairing the comment brings the block back under the formatter, so its
imports and indentation now follow `bracketSpacing: false` like the rest
of the page.

(cherry picked from commit 1087257bb5)
2026-09-30 16:33:16 +00:00
Kam 1a69502ac1 docs: merge the testing imports in the RouterTestingModule example
The "After" example imports `provideLocationMocks` and `SpyLocation` from
`@angular/common/testing` in two separate statements. The migration adds
`provideLocationMocks` to the existing import, so the output is a single
statement.

(cherry picked from commit 79c9df49f1)
2026-09-30 16:32:20 +00:00
Kam 14daa09939 docs: rewrite the RouterTestingModule migration README
The README described a migration that does not exist. It claimed
standalone tests move to `provideRouter([...])` and that a routeless
`RouterTestingModule` becomes `RouterModule.forRoot([])`; the schematic
produces `RouterModule.forRoot(routes)` and a bare `RouterModule`.

It also listed three files that are not in the directory, said the
migration runs during `ng update` when it is not registered in
`migrations.json`, and gave `--migrate-only router-testing-to-provide-router`
as the command. The schematic is registered as
`router-testing-module-migration` with no alias, and takes a `path` option
that went undocumented.

Rewritten against the schematic and its specs, following the shape of the
other `ng-generate` READMEs. It now also records that only `*.spec.ts`
files are migrated, that router options survive the move to `forRoot`, and
that `RouterModule` lands at the end of the `imports` array.

(cherry picked from commit f28519af1f)
2026-09-30 16:32:20 +00:00
Kam d0ea72b5a6 docs: correct the RouterTestingModule schematic description
The collection described the schematic as replacing `RouterTestingModule`
with `provideRouter()`. It replaces it with `RouterModule`, or
`RouterModule.forRoot()` when routes are present, and says so itself when
it finishes.

This string is what `ng generate @angular/core --help` prints.

(cherry picked from commit 6f7ace18eb)
2026-09-30 16:32:20 +00:00
Shuaib Hasan Akib ca96ef39fd refactor(docs-infra): use resource() to highlight code in the home page code block
The home page code block created a new Promise in a `computed` whenever
the code, language or theme changed, and unwrapped it with the `async`
pipe.

Load the highlighted code with `resource()` instead. Its params track the
code, language and theme, so the code is highlighted again when any of
them changes, and the template reads the value directly. This removes
the last `AsyncPipe` usage in adev.

Unlike the `async` pipe, `resource()` tracks its loading as pending work,
so the application is only considered stable once the code has been
highlighted.

Add a spec covering the initial highlight, theme changes and the
language input.

(cherry picked from commit d7717e2efc)
2026-09-30 16:28:45 +00:00
Andrew Scott e9bf52aa03 fix(router): require outlets to match a route before processing child segments
Previously, empty-path outlet groups in a request URL (such as `x:/(detail:2)`,
`///(detail:2)`, or `x:/()`) were allowed to match without a corresponding
route for that outlet name in the route configuration:

1. `processChildren` called `processSegmentGroup` for each child outlet,
   which immediately delegated any zero-segment group with children back to
   `processChildren` against the same parent `config` and `parentRoute`
   without matching a route. Calling `processSegment` directly in
   `processChildren` ensures only the root `UrlSegmentGroup` short-circuits
   to `processChildren`.
2. `processSegmentAgainstRoute` allowed named outlets to pierce empty-path
   routes for other outlets even when the route had no children to pierce into
   or the URL segment group had no segments or children to pierce with.
3. `matchSegmentAgainstRoute` branched into `processChildren` or returned a
   completed leaf match before `getOutlet(route) === outlet` was satisfied,
   and did not require a descendant `TreeNode` match when piercing an
   empty-path route for a different outlet.
4. `noLeftoversInUrl` only checked `!segmentGroup.children[outlet]` rather
   than `!segmentGroup.hasChildren()`, allowing unmatched zero-segment outlet
   groups with child outlets for other names to be treated as having no
   leftovers instead of throwing `NoMatch`.

Together, these allowed crafted URLs with unconfigured zero-segment outlet
groups to fan out across empty-path routes (#70932) or repeatedly evaluate
guards and construct duplicate route snapshot subtrees across sibling outlets
(#70997). Requiring every child segment group to match a route for its outlet
before unwrapping children or completing a match prevents the invalid matches
at the source.

Fixes #70932
Fixes #70997

(cherry picked from commit b6bf6504ad)
2026-09-30 14:39:33 +00:00
Alan Agius 928dcfd258 fix(platform-server): reject protocol-relative paths in resolveUrl
Previously, resolveUrl only checked whether the raw URL string started with '//' before WHATWG URL resolution. When given an input such as '/.//evil.test', WHATWG dot-segment normalization popped the leading '/.', leaving a pathname starting with '//'. This corrupted ServerPlatformLocation and led to protocol-relative open redirects in SSR.

Now, resolveUrl also verifies that the normalized URL pathname does not start with '//' when allowProtocolRelative is false.

Fixes #71076

(cherry picked from commit d7d81e189d)
2026-09-30 14:19:36 +00:00
Andrew Scott 6040d24fea Revert "fix(core): block dangerous data: and vbscript: URLs in URL sanitizer"
This reverts commit e96936a57f.

(cherry picked from commit fc9b2d64e3)
2026-09-30 00:31:05 +00:00
Andrew Scott 69a5e19a51 Revert "fix(core): extend data: URL allowlist for non-executable MIME types"
This reverts commit 2b89a3ba5a.

(cherry picked from commit bab72b9f5d)
2026-09-30 00:31:05 +00:00
arturovt d33f2d02c3 refactor(core): show the enclosing component in the NG0502 hydration error
Before, when hydration couldn't find a server-rendered element, the error
only gave a tag name and a raw tNode index (e.g. `tNode #27`), which is
meaningless without dev-mode source maps. Now it resolves the enclosing
component's host element and includes it in the message, so there's
actually something to search the codebase for.

lView[HOST] covers the normal case. Embedded views (from `@if`/`@for`)
don't have a host of their own, so we fall back to
lView[DECLARATION_COMPONENT_VIEW]?.[HOST].

The descriptive message stays dev-mode only, as usual for RuntimeError
messages, so it's stripped from production bundles.

(cherry picked from commit 93d59c5e7c)
2026-09-29 23:57:50 +00:00
Angular Robot 1003328543 docs: update cross-repo adev docs
Updated Angular adev cross repo docs files.
2026-09-29 15:50:42 -07:00
Andrew Scott c404420d1f fix(devtools): use MouseEvent for mouseover and mouseout listeners in tree visualizer
In @types/d3-selection >= 3.0.12, listener callbacks for mouseover and mouseout
events are strongly typed to receive MouseEvent. Because PointerEvent is a
subtype of MouseEvent, typing the listener parameter as PointerEvent causes
a TypeScript compilation error.

Update nodeMouseoverListeners and nodeMouseoutListeners in GraphRenderer and the
corresponding D3 event handlers in TreeVisualizer to use MouseEvent.

(cherry picked from commit 03795a9f5d)
2026-09-29 22:36:02 +00:00
Matthieu Riegler 0381e83fe0 docs(docs-infra): fix editor unit tests
(cherry picked from commit aa43e86032)
2026-09-29 22:29:23 +00:00
arturovt ad2f291ba0 fix(common): let NgOptimizedImage pass a [srcset] binding through when srcset optimization is disabled
NgOptimizedImage declares a `srcset` input, so a `[srcset]="..."` binding
is captured by the directive and never reaches the `<img>` element. The
directive only reads that input for a conflict check, so with
`disableOptimizedSrcset` the image ended up with no `srcset` at all. The
only way to set one was `[attr.srcset]`.

Now, when `disableOptimizedSrcset` is set and the directive isn't
generating its own srcset, the value from the `[srcset]` binding is
written back to the element.

Fixes #49335

(cherry picked from commit 2cecc4aa60)
2026-09-29 22:04:47 +00:00
Kevin Zhao 9aeef8df6f fix(core): extend data: URL allowlist for non-executable MIME types
The previous allowlist only permitted image/*, video/*, and audio/*,
which broke internal tests using data:application/octet-stream.

Extend the allowlist to include common non-executable MIME types:
font/*, application/octet-stream, application/pdf, application/json,
text/plain, and text/csv. All executable types (text/html, text/javascript,
application/javascript, etc.) remain blocked.

This maintains the allowlist architecture (safe by default) while
covering legitimate data: URL use cases.

(cherry picked from commit 2b89a3ba5a)
2026-09-29 21:23:39 +00:00
Kevin Zhao 7c634ecec4 fix(core): block dangerous data: and vbscript: URLs in URL sanitizer
The URL sanitizer previously only blocked `javascript:` URLs via a
negative lookahead. This left other potentially dangerous URL schemes
unblocked, including `data:text/html` (which can execute scripts in
some environments), `vbscript:` (script execution in legacy IE), and
bare `data:` URIs with no explicit media type.

This change extends the URL sanitizer to also block:
- `vbscript:` URLs
- `data:` URLs except for safe media subtypes (image/*, video/*, audio/*)

Safe media data: URIs (e.g. `data:image/png;base64,...`) continue to be
allowed as they are commonly used for inline images and do not execute
scripts when loaded via `<img src>`.

This resolves a longstanding TODO in html_sanitizer.ts to special-case
`data:image/` URIs, which has been open since the sanitizer was first
written.

Applications that rely on non-media `data:` URLs (e.g. `data:text/plain`
or `data:application/pdf`) in sanitized contexts should use
`bypassSecurityTrustUrl()` to explicitly mark them as trusted.

(cherry picked from commit e96936a57f)
2026-09-29 21:23:39 +00:00
jhjh1214 39ef1dc3b0 docs: add pages for the NG8011 and NG8112 diagnostics
controlFlowPreventingContentProjection (NG8011) and unusedLetDeclaration (NG8112) can be
configured under extendedDiagnostics.checks, but neither had a details page. The NG8112 message
links to extended-diagnostics/NG8112, which currently resolves to the angular.dev home page.

Add a page for each. NG8112 goes under extended-diagnostics like the other configurable checks.
NG8011 is in the 80xx range of ErrorCode, which is for compiler errors documented under
adev/src/content/reference/errors, so its code is flipped to -8011 to match every other
documented code in that decade, which is what makes the compiler add the guide link, and its page
goes under errors instead.

(cherry picked from commit a32cd1ad7f)
2026-09-29 21:14:10 +00:00
guidettj 64da3ac55a docs: add takeUntilDestroyed to router.events
(cherry picked from commit edca4f0c3b)
2026-09-29 21:08:30 +00:00
guidettj d31a996383 docs: remove takeUntilDestroyed to avoid unnecessary rxjs-interop dependency
(cherry picked from commit 636362b278)
2026-09-29 21:08:30 +00:00
Rayan Salhab d522dc6511 fix(docs-infra): reset webcontainer counter on crash
Ensure WebContainer out-of-memory handling only transitions to the error state once, so the sandbox counter is decremented a single time even if the same output is observed by multiple streams. Add regression coverage for the cleanup path.

(cherry picked from commit 7dcedd4e16)
2026-09-29 21:07:53 +00:00
yoominho91 f34b87ba8f refactor(migrations): remove unused skipped inputs set
The migration already records skipped inputs through markFieldIncompatible. Drop the write-only Set and its unused type import.

(cherry picked from commit 81baab42c6)
2026-09-29 21:02:05 +00:00
Amine 6dee7fe91c fix(http): forward reportProgress of httpResource as reportDownloadProgress
`HttpClient` split `reportProgress` into `reportUploadProgress` and
`reportDownloadProgress`, but `httpResource` still passed its
`reportProgress` option to the deprecated `reportProgress` of
`HttpRequest`.

The `progress` signal of `httpResource` only tracks download events, so
`reportProgress` there already means download progress. Forward it as
`reportDownloadProgress` instead of adding a new option.

(cherry picked from commit f458730d37)
2026-09-29 20:56:14 +00:00
Shuaib Hasan Akib dc9fa17631 refactor(docs-infra): drive the progress bar from the currentNavigation signal
The progress bar listened to `NavigationStart` on `router.events`, started
a timer to show the bar after `PROGRESS_BAR_DELAY`, and used `switchMap`
to wait for the first `NavigationEnd`/`Cancel`/`Skipped`/`Error` event to
clear the timer and complete the bar.

Replace this with a single `effect` on the router's `currentNavigation`
signal: while a navigation is ongoing the effect schedules the timer, and
its cleanup, which runs when the navigation ends or is superseded, clears
the timer and completes the bar.

Replace the disabled spec with specs that keep a navigation pending
through a resolver, covering slow, fast and canceled navigations.

(cherry picked from commit 24e11ad41b)
2026-09-29 19:53:56 +00:00
Shuaib Hasan Akib 6b0ef037b8 fix(docs-infra): remove duplicate event image asset entries
The v21 and v22 event images were listed as separate asset entries
(`src/assets/images/v21-event` and `src/assets/images/v22-event`) next to
`src/assets`, which already contains them. They were added when the
images were moved into their own Bazel packages, but the Bazel targets in
`APPLICATION_FILES` are what place the files under `src/assets`; the
extra entries only copy the same files to the same output location
(`assets/images/v2x-event/`) a second time.

The unit-test builder reuses these assets and copies them into the test
output. Since the first copy is read-only in the Bazel sandbox, the
duplicate copy fails with `EACCES: permission denied, copyfile`, which
breaks running `//adev:test` locally.

Remove the redundant entries. The production build output is unchanged
(all non-HTML files, including the event images, are byte-identical) and
`//adev:test` runs again without errors.

(cherry picked from commit b7280d0263)
2026-09-29 19:52:18 +00:00
Kam a8528d4b1a docs: align the service migration README with the schematic
The README documents only the `providedIn: 'root'` case, so it omits the
`@Service({autoProvided: false})` output that a class declared without
options gets. Its inheritance limitation also predates 792edaba48, which
taught the schematic to walk base classes.

(cherry picked from commit 13c3d32643)
2026-09-29 19:25:46 +00:00
Kam 41e0adea5b docs: add a page for the Injectable to Service migration
`ng generate @angular/core:service` shipped in 22.1 without a documentation
page, so it is missing from the migrations index.

The page is written from the schematic rather than from its README, which
documents only the `providedIn: 'root'` case. A class declared without
options also migrates, to `@Service({autoProvided: false})`, and that is the
less obvious of the two outcomes.

It also records behavior the README leaves out: the constructor check stops
at the closest ancestor declared in your own source, the migration covers
test files as well, and a file with both migrated and skipped classes keeps
both the `Injectable` and the `Service` import.

Fixes #71035

(cherry picked from commit c49a12a07a)
2026-09-29 19:25:45 +00:00