6068 Commits

Author SHA1 Message Date
Jessica Janiuk a0361b3ae2 Revert "refactor(core): remove ng when invoking enableProdMode"
This reverts commit cb5879f566.

(cherry picked from commit e673eb6df2)
2026-01-14 16:09:02 +00:00
Matthieu Riegler 492b10686b refactor(core): remove ng when invoking enableProdMode
This was caught while investigating a leak.

(cherry picked from commit cb5879f566)
2026-01-13 19:39:52 +00:00
Jeremy Elbourn 01e5babdf6 docs: update OnChanges API reference w/ signal input
We had some reports of LLMs claiming that `ngOnChanges` does not include
changes for signal-based inputs. This is wrong (and the LLMs just made
it up), but we can update the docs at least to demonstrate `ngOnChanges`
with signal-based inputs.

Previously, the API reference used a real test as a code example, but
updating the test to a signal-based input is more involved than this
change needs to call for.

(cherry picked from commit 871fa1b2dd)
2026-01-13 17:04:27 +00:00
Shuaib Hasan Akib 6a9d4d5458 docs: replace old https://angular.io/license with https://angular.dev/license
(cherry picked from commit 1b4dcc01ff)
2026-01-12 21:41:34 +00:00
SkyZeroZx e72e136096 refactor(core): Add missing OnDestroy to zone and zoneless change detection schedulers
Implements the OnDestroy interface in NgZoneChangeDetectionScheduler and ChangeDetectionSchedulerImpl

(cherry picked from commit fa6e82b569)
2026-01-12 18:00:28 +00:00
SkyZeroZx 450b4c1e90 refactor(core): update error message links to versioned docs (#66374)
Error message links now point to the archived documentation site (v*.angular.dev)
so that referenced content matches the framework version in use.

See angular#44650

PR Close #66374
2026-01-09 22:33:51 +00:00
Miles Malerba 0055f3cc79 fix(forms): Rename signal form [field] to [formField]
This completes the rename started in #66136. `[field]` is too generic of
a selector for the forms system to own, and likely to cause naming
collisions with existing components. Therefore it is being renamed to
`[formField]`

(cherry picked from commit 5671f2cc07)
2026-01-09 22:33:13 +00:00
tomer953 e4bfa5c9e7 fix(migrations): prevent duplicate imports in common-to-standalone migration
The common-to-standalone migration did not check for existing imports
when adding needed imports after removing CommonModule. This change adds deduplication
logic to filter out imports that already exist in the imports array
before adding them, ensuring each import appears only once.

(cherry picked from commit 008e20ca56)
2026-01-09 22:30:52 +00:00
Andrew Scott 696adbca5f refactor(core): Use the provided Document value rather than global in FakeNavigation
This commit ensures the Document used by `FakeNavigation` is the one
passed in the constructor rather than the global `document`, which may
be different.

(cherry picked from commit 49295778bc)
2026-01-08 21:28:23 +00:00
Andrew Scott 5239e471a1 fix(core): handle cancelled traversals in fake navigation
Update fake navigation implementation to correctly handle traversals that are cancelled (e.g. by a precommit handler).
Ensure prospective index is calculated correctly so that subsequent traversals target the correct entry.
Add regression test for cancelled traversals.

(cherry picked from commit 86dc1283e8)
2026-01-08 19:27:41 +00:00
Angular Robot 8aab227960 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-01-08 08:41:59 -08:00
Jaime Burgos f5bad8e417 refactor(core): Improve tree-shakable RuntimeError error for INVALID_FIELD_DIRECTIVE_HOST
Improves the tree-shakable runtime error handling for `INVALID_FIELD_DIRECTIVE_HOST`.

(cherry picked from commit 5c75d29fb4)
2026-01-07 22:32:29 +00:00
Jessica Janiuk a6a2621bf9 fix(core): fix memory leak with event replay
This ensures event replay does not hold on to elements after an application has been destroyed.

fixes: #59261
(cherry picked from commit 30e9c62bdf)
2026-01-07 22:27:47 +00:00
Kristiyan Kostadinov fbb37d8388 refactor(core): remove unused instruction parameter
The `thisArg` in pure functions isn't used so we can drop it. We still need to keep it on the underlying implementation, because pipe instructions rely on it.

(cherry picked from commit 4dc5ae54a9)
2026-01-07 15:05:24 -05:00
Kristiyan Kostadinov 7c74674eb0 fix(core): avoid leaking view data in animations
The animations code currently tracks which views have running leave animations by adding them to a `Set`. This can leak memory if we don't clean something up on time.

These changes switch to tracking the views by their ID which doesn't risk retaining the view.

Fixes #66255.

(cherry picked from commit 80b0fbba1f)
2026-01-07 12:39:04 -05:00
hawkgs c1e9627f6d docs(core): fix Ivy view data docs tables
The current formatting prevents the tables to be rendered making it hard to read them.

(cherry picked from commit 51ed487fae)
2026-01-07 09:22:47 -05:00
Miles Malerba e3fba182f9 feat(forms): add [formField] directive
This will replace the `[field]` directive, since `[field]` is a very
generic name for signal forms to commandeer

refactor(forms): hook up `formField` directive in compiler

Hooks up the `formField` direcive to get the same treatment as the
`field` directive in the compiler.

apply updated formatting

(cherry picked from commit 2d85ae5811)
2026-01-06 17:21:09 -05:00
Leon Senft af1d4acb9d refactor(forms): bind native properties on interop controls
The framework will now bind all field state properties to their
corresponding native properties (if any) on interop form controls (those
using `ControlValueAccessor`), excluding those handled explicitly by
`ControlValueAccessor` such as `disabled`.

(cherry picked from commit 82a2de201f)
2026-01-06 13:12:21 -05:00
Leon Senft 0e8b9d8cde refactor(forms): bind field properties to all directives on interop controls
The framework will now bind the field state properties to all matching
directive inputs on form controls using Reactive Forms'
`ControlValueAccessor`.

(cherry picked from commit 15bddbdcda)
2026-01-06 13:12:21 -05:00
Leon Senft ff37a13913 refactor(forms): bind field properties to all directives on custom controls
The framework will now bind the field state properties to all matching
directive inputs on custom form controls.

(cherry picked from commit 0c8f15d546)
2026-01-06 13:12:21 -05:00
Leon Senft a4ba820d36 refactor(forms): bind field properties to all directives on native controls
Since the `Field` directive manages binding `FieldState` properties to
the underlying form control automatically, the type checker prohibits
explicit bindings to the same properties to avoid conflicts. This proved
problematic in cases where developers wanted to bind these properties to
the inputs of other directives on form controls. Now the framework will
bind the field state properties to all matching directive inputs on
native controls.

Fix #65617

(cherry picked from commit c149f47ef6)
2026-01-06 13:12:21 -05:00
Alan Agius f9c29572d2 fix(core): sanitize sensitive attributes on SVG script elements
This commit updates the DOM security schema and sanitization logic to properly recognize and sanitize `href` and `xlink:href` attributes on SVG `<script>` elements.
2026-01-06 12:16:03 -05:00
Matthieu Riegler a119427834 docs: rewrite testing docs
Those rewrites focus on using Vitest instead of jasmine, drop usages of `fakeAsync`, present modern testing strategy that rely on `whenStable` more than explicit calls to `detectChanges`.

fixes #42748, #48510, #64962, #65987, #66029,  #66150

(cherry picked from commit 71cde39ff0)
2026-01-05 19:38:27 -05:00
SkyZeroZx 8f26a52aa8 refactor(core): introduce tree-shakeable runtime error codes for NgModule handling and ViewContainerRef errors
Adds new tree-shakeable runtime error codes to improve error reporting for
NgModule resolution issues (duplicate or missing IDs) and invalid ViewContainerRef
operations involving destroyed views.

(cherry picked from commit 1532be9d00)
2026-01-05 16:52:27 -05:00
SkyZeroZx 6cfbc736b4 docs: update tsDoc code examples to use TypeScript syntax highlighting
(cherry picked from commit b735c45974)
2026-01-05 12:31:47 -05:00
SkyZeroZx 06109f5ad3 docs: add @see links to API docs for better discoverability
(cherry picked from commit fa430bffb0)
2026-01-05 12:12:28 -05:00
Angular Robot 71a4373fbb build: update cross-repo angular dependencies
See associated pull request for more information.
2026-01-02 14:24:47 +01:00
Kristiyan Kostadinov f8b6a3fed1 Revert "refactor(core): Add ngDevMode guards and new sanitization error codes"
This reverts commit 4e7e38c591.

(cherry picked from commit 1765ebe79b)
2026-01-02 11:37:26 +01:00
Kristiyan Kostadinov 523dbaf1c3 fix(compiler): stop ThisReceiver inheritance from ImplicitReceiver
Back in #39323, I added a new `ThisReceiver` node to represent accesses done through `this` and I ended up making it inherit from `ImplicitReceiver`. The logic was that in most cases accessing through `this` was the same as the implicit access.

Over the years this has proven to not be a great idea, because no other AST nodes do this and one has to keep it in mind whenever dealing with `ImplicitReceiver`.

These changes remove the inheritance and update all of the usage sites accordingly.

(cherry picked from commit fa7cb4b87a)
2026-01-02 08:21:53 +01:00
SkyZeroZx aa3b028e25 refactor(core): implement missing OnDestroy for schedulers
Implements the missing OnDestroy interface. Also removes an unused generic from a performance logging function.

(cherry picked from commit 02e80b4ea2)
2026-01-02 08:20:00 +01:00
SkyZeroZx 0aa5c7b815 refactor(core): remove unused Injector and Renderer2 dependencies from hydration functions
Removes the unsued `Injector` & `Renderer2` dependency from the hydration annotation process.

(cherry picked from commit 93fe833088)
2026-01-02 08:11:19 +01:00
Leon Senft 9748b0d5da fix(forms): support custom controls with non signal-based models
* Recognize directives with non signal-based models as valid custom controls
* Relax type checker to allow non signal-based models

The `FormValueControl` and `FormCheckboxControl` interfaces still
require a `model()`-input, however, a custom control need not implement
either interface to be bound by the `Field` directive.

All of the following examples can be used to define a custom control:

```ts
// Preferred: model()
class MyFormControl implements FormValueControl<string> {
  readonly value: model.required<string>();
}

// Supported: input() + output()
class MyFormControl {
  readonly value: input.required<string>();
  readonly valueChange: output<string>();
}

// Supported: @Input() + @Output()
class MyFormControl {
  @Input({required: true}) value!: string;
  @Output() valueChange: new EventEmitter<string>();
}
```

The latter two may still choose to implement `FormUiControl` for other
properties, but again it is not required.

Fix #65478

(cherry picked from commit cb09fb8308)
2026-01-02 08:09:07 +01:00
Leon Senft ab86c90c20 refactor(forms): always bind [field] to ControlValueAccessor if present
Change the order of precedence that `[field]` binds to from

  1. Custom control (`FormValueControl`, `FormCheckboxControl`)
  2. Interop control (`ControlValueAccessor`)
  3. Native control (`<input>`, `<select>`, `<textarea>`)

to

  1. Interop control (`ControlValueAccessor`)
  2. Custom control (`FormValueControl`, `FormCheckboxControl`)
  3. Native control (`<input>`, `<select>`, `<textarea>`)

This ensures that Reactive Forms controls authored to use
`ControlValueAccessor` work correctly with Signal Forms, even if they
happen to conform to the `FormValueControl` interface.

(cherry picked from commit 817e2b87a8)
2026-01-02 08:09:06 +01:00
SkyZeroZx ce7b1ab3b6 refactor(core): Add ngDevMode guards and new sanitization error codes
Adds new runtime sanitization error codes. Adds `ngDevMode` guards around
error message strings to ensure detailed diagnostics are included only
in development mode. This allows production builds to tree-shake verbose error descriptions, reducing bundle size.

(cherry picked from commit 4e7e38c591)
2026-01-02 08:08:25 +01:00
Andrew Seguin 0edbee4550 fix(core): explicitly cast signal node value to String
If the computed's `toString` is called and `node.value` is a Symbol, the browser will throw an exception `ERROR TypeError: Cannot convert a Symbol value to a string`

Symbols cannot be implicitly changed to strings. This change changes the conversion to be explicit by wrapping `node.value` with `String()`

This can be reproduced if you create a computed with `createComputed(computation, equal)` and call `toString()` while `node.value` is something like `Symbol(UNSET)`

(cherry picked from commit e2a9938c51)
2025-12-17 14:38:41 -08:00
Alan Agius 48492524ea fix(core): use mutable ResponseInit type for RESPONSE_INIT token
The `RESPONSE_INIT` token previously used `ResponseInit`. However, `@types/node` (and `undici`) definitions for `ResponseInit` mark properties as `readonly`, which differs from the standard DOM `ResponseInit`.

This commit introduces a `ResponseInit` type that explicitly removes `readonly` modifiers to ensure compatibility and allow for mutable options. This type is now used by the `RESPONSE_INIT` token and is exported from `@angular/core`.

(cherry picked from commit f516370c8e)
2025-12-17 09:35:27 -08:00
Andrew Kushnir a4d2de8179 Revert "fix(core): explicitly cast signal node value to String"
This reverts commit c501b25d04.

(cherry picked from commit 9fa77af110)
2025-12-16 17:37:38 -08:00
Andrew Seguin 0eb623c05a fix(core): explicitly cast signal node value to String
If the computed's `toString` is called and `node.value` is a Symbol, the browser will throw an exception `ERROR TypeError: Cannot convert a Symbol value to a string`

Symbols cannot be implicitly changed to strings. This change changes the conversion to be explicit by wrapping `node.value` with `String()`

This can be reproduced if you create a computed with `createComputed(computation, equal)` and call `toString()` while `node.value` is something like `Symbol(UNSET)`

(cherry picked from commit c501b25d04)
2025-12-16 16:38:07 -08:00
SkyZeroZx dc0aae9a59 docs: add section about reactive contexts
(cherry picked from commit 62ccd64e9f)
2025-12-16 16:35:28 -08:00
Matthieu Riegler feed89e83c ci: reformat files
This is after we've slightly changed a rule in #66056

(cherry picked from commit 6270bba056)
2025-12-16 14:44:25 -08:00
SkyZeroZx 0a5fd6b6d4 refactor(core): conditionally include debug names based on ngDevMode
Conditionally include debug-related metadata based on `ngDevMode` to avoid
unnecessary information in production builds.

(cherry picked from commit bf2e50843d)
2025-12-16 09:37:42 -08:00
Alan Agius 31b909040a refactor(compiler): remove unnecessary sanitization for safe attributes
Remove sanitization for attributes that cannot execute code (e.g. `javascript: URIs`).

(cherry picked from commit d4111eebc6)
2025-12-15 14:13:42 -08:00
SkyZeroZx 69b089a6c9 docs: Adds documentation for the NG0919 error
Adds a new documentation page for the NG0919 error, which indicates a circular dependency in Angular applications.

fixes  #65968

(cherry picked from commit bb65520991)
2025-12-15 09:52:20 -08:00
Andrew Kushnir 534b1b507d Revert "refactor(compiler): remove unnecessary sanitization for safe attributes"
This reverts commit 128aef0ede.

(cherry picked from commit 8243bb3064)
2025-12-12 12:59:50 -08:00
Kristiyan Kostadinov 4c8fb3631d fix(core): throw better errors for potential circular references
Currently circular references in user code manifest themselves with an error like `Cannot read properties of undefined (reading 'ɵcmp')`. This is a bit cryptic so these changes add an assertion mentioning circular references.

Relates to #65917.

(cherry picked from commit 7be4ddef1c)
2025-12-12 08:06:30 -08:00
Alan Agius b8cb6cda30 refactor(compiler): remove unnecessary sanitization for safe attributes
Remove sanitization for attributes that cannot execute code (e.g. `javascript: URIs`).

(cherry picked from commit 128aef0ede)
2025-12-12 08:06:03 -08:00
SkyZeroZx 69d243abb7 fix(core): avoid false-positive deprecation when using InjectionToken with factory only
Prevents the deprecation warning that was incorrectly triggered when
defining an InjectionToken with only a `factory`, which correctly
defaults to the `root` scope.

(cherry picked from commit 4f6014a756)
2025-12-11 11:20:17 -08:00
Angular Robot c937da491c build: update cross-repo angular dependencies
See associated pull request for more information.
2025-12-10 16:42:43 -08:00
SkyZeroZx 6930a2e8c8 docs: update forwardRef usage with signals and add HostListener note
(cherry picked from commit bff2dcb93c)
2025-12-10 12:23:33 -08:00
Andrew Scott 497c0e36ab refactor(core): Add transition.to property to FakeNavigation
This matches the upstream changes in https://github.com/whatwg/html/commit/f19930f98afeb7565cfc1cbc6a1d4a2086535bca

(cherry picked from commit 5988bdedae)
2025-12-10 10:18:13 -08:00