15458 Commits

Author SHA1 Message Date
Jaime Burgos 64d6d47a0c fix(forms): preserve intermediate number values in signal forms
Preserve raw native input text while editing so parsed model values are not written back on every keystroke.

(cherry picked from commit 2e32872720)
2026-07-15 15:56:52 -07:00
Angular Robot 829d98e9ae build: update cross-repo angular dependencies to v22.0.7
See associated pull request for more information.
2026-07-15 14:49:17 -07:00
splincode fa6a1d26bd test(elements): disambiguate the setTimeout spy type
Bind spyOn explicitly to Window so Jasmine uses the DOM setTimeout signature that returns a number instead of the Node.js Timeout type. Remove the unsafe any cast and the obsolete TODO.

(cherry picked from commit 24a3c63976)
2026-07-15 14:48:32 -07:00
cexbrayat 70500e4067 fix(core): preserve explicit input transform write type
If a directive has an input declared as `dismissible = input<boolean>(true, {transform: booleanAttribute});` then the following templates were not compiling:

```
<div directiveName dismissible="true"></div>
<div directiveName dismissible></div>
```

This commit fixes the issue, without breaking contravariant consumers.

(cherry picked from commit 0ae6d81ed2)
2026-07-15 12:02:23 -07:00
arshiya tabasum 91e33aa1de fix(common): avoid prototype lookups in date format caches
The NAMED_FORMATS and DATE_FORMATS caches were plain objects read with a
truthy check keyed by a token from the format string, so a token matching
an inherited Object member (e.g. `__proto__`) resolved to a prototype
value. Create both caches with a null prototype so only real entries are
returned.

(cherry picked from commit 359fb503b8)
2026-07-15 12:01:53 -07:00
Shuaib Hasan Akib a6174d5900 refactor(forms): warn when a text input receives a null value in Signal Forms
Native text `<input type="text">` controls do not support `null` values.
When a Signal Forms model bound to a text input is set to `null`, the value
is silently coerced to an empty string.

(cherry picked from commit 37f3279fe7)
2026-07-15 12:01:17 -07:00
Kristiyan Kostadinov c89f71a74c fix(core): ignore processing instruction syntax in templates
Updates the template parser to detect and ignore processing instruction syntax (e.g. `<? foo ?>` or `<? foo >`). Currently it is being printed out as text.

Fixes #34371.

(cherry picked from commit 68ac204074)
2026-07-15 11:57:06 -07:00
Cameron Smick e881b962cc refactor(core): move signal debug graph interfaces to primitives/devtools
Move the DebugSignalGraph, DebugSignalGraphEdge, and DebugSignalGraphNode interfaces from packages/core/src/render3/util/signal_debug.ts into the packages/core/primitives/devtools/src package. This decouples the signal graph debug types from runtime render3 utilities and allows devtools and internal core tooling to import them directly from primitives as type-only exports.

(cherry picked from commit d997a96b47)
2026-07-14 11:09:27 -07:00
CYANO-01 b34bf0dce8 fix(platform-browser): prevent ReDoS in SOURCEMAP_URL_REGEXP
Replace the lazy quantifier (.+?) with a negated character class
([^\s*]+) that excludes whitespace and asterisks. Source map URLs
never contain these characters, so the fix is semantically
equivalent while eliminating the O(n²) backtracking path triggered
by unclosed /*# sourceMappingURL= fragments.

Fixes: polynomial ReDoS in addBaseHrefToCssSourceMap
(cherry picked from commit fb6b354fbd)
2026-07-14 10:57:25 -07:00
Sonu Kapoor 20b7dc3023 fix(http): prevent interceptor signal reads from leaking into calling reactive contexts
When `HttpClient` is called from within an `effect()` or other reactive
context, any signal reads performed inside HTTP interceptors were
inadvertently tracked by that context. This caused the effect to
re-execute whenever those signals changed, regardless of whether the
signal was semantically related to the HTTP call.

The fix wraps the interceptor chain invocation in `untracked()` so that
signal reads inside interceptors — both functional (`withInterceptors`)
and class-based (`withInterceptorsFromDi`) — are invisible to the
calling reactive context. This matches the precedent set by the resource
API, which also wraps its loader in `untracked()` for the same reason.

Fixes #58682

(cherry picked from commit 6d043f8657)
2026-07-14 09:21:13 -07:00
LordKay-sudo c88ddde1c9 fix(compiler-cli): re-tag SourceFiles after TsCreateProgramDriver.updateFiles()
TypeScript reuses SourceFile objects between old and new programs, so untagging the old program also untags shared files in the new program. Re-apply shim tags on the new program to prevent getSemanticDiagnostics() crashes with TS 5.5+.

(cherry picked from commit ae0ec7315c)
2026-07-14 09:18:40 -07:00
Doug Parker 1046fd9e56 refactor(core): remove deprecated unregisterTool from ModelContext
In the WebMCP specification, tools are unregistered by aborting the `AbortSignal` provided in `registerTool(tool, {signal})`. The deprecated `unregisterTool` method on `ModelContext` is no longer needed or part of the standard, and is now removed from the TypeScript interface definition.

(cherry picked from commit ce4f7adc95)
2026-07-10 10:56:45 -07:00
Doug Parker 5936ffb80c refactor(core): update WebMCP tool registration to be asynchronous
In the latest WebMCP specification and Chromium preview builds, `document.modelContext.registerTool` was updated to be asynchronous and return a `Promise`: https://groups.google.com/a/chromium.org/g/chrome-ai-dev-preview/c/xQWt0b1sZIE/m/UJznbNCIAwAJ?utm_medium=email&utm_source=footer

This commit update adjusts Angular's experimental WebMCP implementation (`declareExperimentalWebMcpTool` and form registration) to be async as well, returning `Promise<void>`.

(cherry picked from commit f908140d71)
2026-07-10 10:56:45 -07:00
Matthew Beck c82ae67e3d Revert "fix(core): allow static attributes for explicit input transforms"
This reverts commit 9b9b0e93c9.

This broke g3. Not sure yet why it didn't break externally. We can
investigate and fix following this revert.

(cherry picked from commit 1fb4678207)
2026-07-09 17:58:26 -07:00
Angular Robot ec9b4793e8 build: update cross-repo angular dependencies
See associated pull request for more information.

Closes #69411 as a pr takeover
2026-07-09 16:05:25 -07:00
arshiya tabasum 8ce1fcf7fa fix(localize): use Object.hasOwn for placeholder lookup in translate
`translate()` looked up substitutions with `message.substitutions.hasOwnProperty(placeholder)`. A message whose placeholder is named `hasOwnProperty` stores that key on the plain substitutions object, shadowing the method, so the lookup calls the substitution value and throws a TypeError. Use `Object.hasOwn` instead, which resolves through `Object` and is unaffected by the shadowed key, matching the recent `I18nSelectPipe` fix.

(cherry picked from commit 2a4f582731)
2026-07-09 12:29:59 -07:00
Bhuvansh855 5d06fcb109 test(forms): register writeback test control as CVA
Register the custom writeback test control as an NG_VALUE_ACCESSOR
so it is recognized as a valid formField host during debounce
writeback testing.

(cherry picked from commit 12fe700ad8)
2026-07-09 12:29:11 -07:00
Bhuvansh855 6cf7446afa fix(forms): prevent stale CVA writeback during debounce
Use controlValue() instead of value() when synchronizing
ControlValueAccessor instances.

When debounce is active, value() can still contain the
previous model value while controlValue() reflects the
latest user-entered value. This prevents stale values
from being written back to the CVA before the debounce
is flushed.

Adds a regression test covering the debounce scenario.

(cherry picked from commit 2e0cb52dbf)
2026-07-09 12:29:10 -07:00
cexbrayat 94d9591b51 fix(core): allow static attributes for explicit input transforms
This is a follow-up to #67997, which allowed explicit read generics with input transforms, such as `input<boolean>(false, {transform: booleanAttribute})`.

That fixed the declaration, but static template attributes like `dismissible="true"` and bare `dismissible` were still checked as strings against the read type. Allow the fallback write type to include static attribute strings so these template forms compile.

(cherry picked from commit 9b9b0e93c9)
2026-07-09 12:28:29 -07:00
Shuaib Hasan Akib c0c97b5b22 docs(platform-server): add error reference page for NG05703 and wire up RuntimeError
Add a dedicated error reference page for NG05703 (suspicious URL origin
change during SSR) and update the error to use RuntimeError with a
negative code so the error message automatically includes a link to the
docs page in both dev and production builds.

Update affected tests in url_spec.ts, platform_location_spec.ts, and
integration_spec.ts to match the new NG05703-prefixed error message
format.

Fixes: #69667
(cherry picked from commit 13b6bbd6a0)
2026-07-09 11:56:06 -07:00
hawkgs aa03cb97a9 test(language-service): empty template literal interpolation
Ensure that empty template literal interpolation is handled gracefully.

(cherry picked from commit 53ca8c25cb)
2026-07-09 09:56:45 -07:00
hawkgs 5b516e3a58 fix(compiler): parsing of an empty template literal interpolation
Even if we have an `EmptyExpr`, add that expression to the expressions array when a literal is parsed.
The lack of the expression results in a discrepancy in the sizes of the `elements` and the `expressions`
arrays of a `TemplateLiteral`, that result in an error when we visit that same literal due to the missing
expression.

Fixes #69699

(cherry picked from commit da52137724)
2026-07-09 09:56:45 -07:00
arshiya tabasum 22d5a091d1 fix(localize): build runtime translations map with a null prototype
loadTranslations stores parsed translations into the shared global
$localize.TRANSLATIONS keyed by message id. Those ids come verbatim from
the translations map (typically parsed from a translation file), so a
translation whose id is __proto__ assigns through the inherited __proto__
setter, reparenting the map rather than storing the entry (and throwing
under --disable-proto=throw). Create the map with Object.create(null) in
loadTranslations and clearTranslations so __proto__ is an ordinary key.

(cherry picked from commit 5de0ea5f23)
2026-07-09 09:56:14 -07:00
Matthieu Riegler 1b9964675f fix(forms): allow multiple async validators
When a parent form element defines an async validator, its resource's `params` function needs to evaluate `syncValid()`, which causes unvisited child form nodes to be lazily instantiated. If any of these lazily instantiated child nodes also define an async validator, their resource is initialized while the parent's `params` function is still evaluating. This incorrectly triggers Angular core's `NG0992` guard (`Cannot create a resource inside the params of another resource`).
This commit exports `ɵsetInParamsFunction` and `ɵisInParamsFunction` from `@angular/core` and uses them in `FieldMetadataState.runMetadataCreateLifecycle` to explicitly detach the lazy creation of form metadata from the parent's reactive `params` context.

fixes #69620

(cherry picked from commit 5cb8c733a3)
2026-07-09 09:55:33 -07:00
Matthieu Riegler ab18f5ff0b refactor(core): cleanup Meta service
The service had a rather old implementation. This is mostly a cleanup.

(cherry picked from commit c0eaaedef3)
2026-07-08 11:23:58 -07:00
volkanfilazi eca3395019 removed console log
(cherry picked from commit 8e8c5524bb)
2026-07-08 11:23:05 -07:00
volkanfilazi 171669f7b2 fix(forms/signals): make extractValue reactive for compat AbstractControl values
(cherry picked from commit b542302a23)
2026-07-08 11:23:05 -07:00
Matthieu Riegler ad3693f44f docs(forms): add jsdoc for ReadonlyFieldState
(cherry picked from commit d93e922517)
2026-07-08 10:45:36 -07:00
SkyZeroZx 748faa4f95 docs(docs-infra): Add build-time validation for API and guide links using route manifest
Adds build-time validation to catch broken, stale, or miscased internal documentation links in both JSDoc and markdown, including `/api/` and `/guide/` URLs and their fragments. Updates the documentation pipeline to share the canonical route manifest, ensuring that all references are checked against the current navigation structure.

(cherry picked from commit c1829f6d7c)
2026-07-08 10:24:51 -07:00
P4 534fe81a89 fix(compiler-cli): apply debugName transform to required signal queries
Transform assumed `.required` functions always take options as the first argument.
This is true for `input` and `model`, but not for `viewChild` and `contentChild`,
which take the same arguments as non-required versions.

Change the code to put options for signal queries in the right position,
causing debugName to be correctly generated for signal queries.

(cherry picked from commit eb2a8ff63f)
2026-07-07 11:05:28 -07:00
Cameron Smick c91a951817 refactor(core): move devtools ai tool definition types to primitives
Extract the AI tool definition interfaces from the core debug module to the devtools primitives module. This relocates ToolDefinition, ToolGroup, and DevtoolsToolDiscoveryEvent to the primitives folder, exposing them cleanly via "export type" in the devtools entry point, improving module organization and readability.

(cherry picked from commit bf6dba878e)
2026-07-07 10:18:10 -07:00
rootvector2 8e6d7f7190 fix(router): use safe hasOwnProperty when parsing query params
`parseQueryParam` and the AngularJS-compat `parseKeyValue` accumulate query params into a plain object and check key presence with `obj.hasOwnProperty`, so a `hasOwnProperty` query key clobbers the method and the next lookup throws `TypeError`. Switch both to `Object.hasOwn`, which can't be shadowed by a query key.

(cherry picked from commit e5c37f21de)
2026-07-07 10:09:38 -07:00
cexbrayat d4a926a762 fix(migrations): remove stale model import in model-output migration
Remove the model import after migrating all model() usages in a file.

(cherry picked from commit fbb705e6fd)
2026-07-07 10:08:48 -07:00
arturovt f5e69de1e0 refactor(compiler-cli): use BindingType enum check in suffix-not-supported extended diagnostic
Replaces the `node.keySpan.toString().startsWith('attr.')` string allocation in the `suffixNotSupported` extended template check with an O(1) `node.type === BindingType.Attribute` enum comparison.

The diagnostic message string is also extracted to a module-level constant so it is created once at module load time instead of on every diagnostic emit.

Additionally, this change adds missing test coverage for the `.%` and `.em` suffixes, as well as for a plain `attr.` binding without a style suffix.

Measured with a 100-iteration microbenchmark before and after the change (MacBook Pro 2018, Intel CPU):

```ts
const start = performance.now();
for (let i = 0; i < 100; i++) {
  new ExtendedTemplateCheckerImpl(templateTypeChecker, program.getTypeChecker(),
    [suffixNotSupportedFactory], {}).getDiagnosticsForComponent(component);
}
console.log((performance.now() - start) / 100, 'ms/iter');
```

Before: `~0.24 ms/iter`
After: `~0.14 ms/iter` (~40% faster)
(cherry picked from commit ab618bdc0f)
2026-07-07 10:05:10 -07:00
cexbrayat 3b08201bfb fix(compiler-cli): detect uninvoked signals in bound expressions using ternary
Extend the interpolated signal extended diagnostic to inspect ternary-bound expressions and report uninvoked signal reads in bound bindings.

```
<div [style.width]="width() ? 1 : width"></div>
```

where the false branch should invoke the signal as `width()`.

(cherry picked from commit eac363e92e)
2026-07-07 10:01:55 -07:00
SkyZeroZx 0a6af1496b fix(migrations): preserve transitive NgModule references when pruning
avoids unintended removal of indirectly required modules

Fixes #62865

(cherry picked from commit 0a5a2b768c)
2026-07-07 10:01:17 -07:00
arturovt 3ac3753cd9 refactor(forms): avoid unnecessary Set allocation in maybeRemoveStaleArrayFields
Three small, behavior-neutral cleanups to maybeRemoveStaleArrayFields:

1. Avoid allocating an empty Set when prevData.byTrackingKey is
   undefined. new Set(undefined) previously created an unused empty
   Set on every call for parents with no tracking keys.

2. Guard the per-element tracking-key check on `oldTracking` being
   defined, skipping the isObject/hasOwn check entirely when there's
   nothing to track.

3. Replace childValue.hasOwnProperty(identitySymbol) with
   Object.hasOwn(childValue, identitySymbol). hasOwnProperty throws
   on null-prototype array elements (Object.create(null)), which
   would crash computeChildrenMap. Object.hasOwn is null-prototype-safe
   and preserves "own property" semantics (does not match inherited
   identitySymbol values).

4. Replace `data.byTrackingKey?.delete(id)` with
   `data.byTrackingKey!.delete(id)`. The optional chaining was dead:
   if oldTracking.size > 0, prevData.byTrackingKey (and therefore
   data.byTrackingKey, same Map reference via the spread) is always
   defined. The `?.` masked this invariant; `!` documents it and
   would surface a runtime error instead of a silent no-op if the
   invariant is ever violated.

Verified via performance.mark/measure instrumented directly inside
the function (count=1 call for a single-field edit in both cases).
Total duration dropped from ~0.7ms to ~0.1ms, consistent with the
avoided Set allocation in (1) and (2).

(cherry picked from commit 73ab88e65b)
2026-07-07 09:51:48 -07:00
Shuaib Hasan Akib 45caa92e2a refactor(core): remove unused utility functions
Remove `isIterable` from `util/iterable.ts` and
`newTrustedFunctionForDev` from `util/security/trusted_types.ts`
as they are no longer referenced anywhere in the codebase.

(cherry picked from commit 01bb0a2f28)
2026-07-07 09:48:11 -07:00
arturovt 97197786b3 docs: add NG05200 error reference page for SANITIZATION_UNSAFE_SCRIPT
Adds a reference page for `NG05200`, thrown by `DomSanitizer` when a value is bound to a `<script>` element without being marked trusted via `bypassSecurityTrustScript`. Covers why Angular rejects script content outright, how to reproduce the error, the escape hatch, and the XSS caveat.

(cherry picked from commit 806a3ada26)
2026-07-07 09:09:53 -07:00
Matthieu Riegler fd4ddcafed fix(compiler): use regular optional chaining expression for safe function calls in TCBs
Optional return types should not report non-nullable optional chaning on function calls.

fixes #69609

(cherry picked from commit 997b772f28)
2026-07-06 14:02:44 -07:00
SkyZeroZx 4d2133ec43 test(router): Update tests to use currentNavigation()
Updates router integration tests to use the `currentNavigation()` method instead of deprecated `getCurrentNavigation`.

Also replaces direct `setTimeout` calls with the `timeout()` utility function.

(cherry picked from commit d9639201b3)
2026-07-06 14:01:15 -07:00
Shuaib Hasan Akib c1a951aac3 refactor(forms): improve type safety of RadioControlRegistry._accessors
Replace `any[]` with `[NgControl, RadioControlValueAccessor][]` for the
private `_accessors` field in `RadioControlRegistry`. This aligns the
field type with how it is used in `add()`, `remove()`, `select()`, and
`_isSameGroup()`, which already typed its parameter as
`[NgControl, RadioControlValueAccessor]`.

(cherry picked from commit 0285f558f9)
2026-07-06 13:59:21 -07:00
Matthieu Riegler f03639cfd4 docs: correct docs about the chain behavior.
Even if the chained resource has a value, it might throw an error.

fixes #69330

(cherry picked from commit 5ad937be5e)
2026-07-06 13:37:27 -07:00
SkyZeroZx 8cedaecca8 docs: add @see references to Signal Forms
(cherry picked from commit bbbcf8fc7f)
2026-07-06 13:35:24 -07:00
arshsmith1 c238bd2ad7 fix(router): handle outlet named __proto__ in segment group maps
Outlet maps are keyed by names read verbatim from the url, so a name like
`__proto__` (e.g. `/one(__proto__:two)`) is assigned through the inherited
`__proto__` setter instead of creating an outlet. This drops the outlet and
mutates the map's prototype, and throws under Node's `--disable-proto=throw`.

Build these outlet maps with `Object.create(null)` so `__proto__` is treated as
an ordinary key. Covers `parseParens` and `squashSegmentGroup` in url_tree.ts,
`createSegmentGroup` in apply_redirects.ts, and `replaceSegment` and
`updateSegmentGroupChildren` in create_url_tree.ts.

(cherry picked from commit cbbb1d8ba1)
2026-07-06 13:34:08 -07:00
Shuaib Hasan Akib ca13b42e7c fix(router): fix malformed jsdoc comment for RouterLinkWithHref export
The export statement was incorrectly placed inside the JSDoc comment block,
and there was a stray text fragment "nstead." from the deprecation message.
This moves the export statement outside the comment and removes the stray text.

(cherry picked from commit a74801c59c)
2026-06-30 17:59:40 -07:00
arturovt eb8fb9fe58 fix(common): use Object.hasOwn in I18nSelectPipe to handle null-prototype and shadowed mappings
`I18nSelectPipe.transform()` called `mapping.hasOwnProperty()` directly,
which fails in two edge cases:

- Mappings created with `Object.create(null)` have no prototype and
  therefore no `hasOwnProperty` method, causing a TypeError at runtime.
- Mappings where a key literally named `hasOwnProperty` shadows the
  built-in method return incorrect results silently.

Replace both call sites with `Object.hasOwn(mapping, key)`, which
delegates through `Object` directly and is immune to both issues.

Add two regression tests that demonstrate the broken behaviour before
the fix and pass after it.

(cherry picked from commit 311aff05aa)
2026-06-30 17:46:41 -07:00
SkyZeroZx ced0180b06 fix(core): reject dynamic script host elements
The previous fix for GHSA-692r-grfm-v8x7 was incomplete because it rejected script tags only when locating an explicit host element. Dynamic component instantiation can also infer the host element from the component selector.

Move the script-host rejection to the point where ComponentFactory has resolved the host element for either path, so createComponent rejects script hosts consistently.

(cherry picked from commit d7f70616a0)
2026-06-30 17:29:41 -07:00
Andrew Scott c3be83cfe1 refactor(core): allow AnimationClassBindingFn to return undefined or null
The AnimationClassBindingFn type was too restrictive, only allowing `string | string[]`. However, the runtime (`getClassListFromValue`) safely handles `undefined` and `null` values by treating them as no animation.

This change updates the type to allow `undefined` and `null`, which is consistent with other class/style bindings in Angular and avoids requiring workarounds (like empty strings) in host bindings.

Added a compliance test case to verify that `[animate.enter]` with a potentially `undefined` value compiles correctly.

(cherry picked from commit a7bde662c3)
2026-06-30 17:28:04 -07:00
Alex Rickabaugh af7edd90ca Revert "fix(compiler-cli): include toSignal in debugName transform"
This reverts commit 165995285c. Reason: breaking
in g3 (ngDevMode not defined)

(cherry picked from commit a5f1b20373)
2026-06-30 13:24:21 -07:00