Hard-code an explicit `outputSchema` for the implicitly generated signal forms WebMCP tool. This schema accurately describes the simplified success and error object returned by the tool execution, allowing AI agents to confidently interpret the results without hallucination.
Simplify the output structure of the WebMCP tool for signal forms from a verbose array of content blocks to a simple JSON object containing a boolean success flag and an optional array of error strings. This reduces token usage and provides a more semantic output format for AI agents to consume.
When a `[formField]` element also has a ControlValueAccessor, a `Date`
from `minDate()` or `maxDate()` was written to the native `min`/`max`
property with `Date#toString()`, which date inputs ignore. Format it
like the native and custom control paths do.
Custom control (`value` or `checked` model, no ControlValueAccessor) bound with NgModel,
FormControlDirective or FormControlName is set up by setupCustomControl, which doesnt call
setUpValidators. Validator directives on element (required, minlength, any directive providing
NG_VALIDATORS) and NG_VALIDATORS provided by control itself never reach FormControl, so control
stays valid and form submits. ControlValueAccessor path merges them, and cleanUpControl already
removes them when FormControlDirective or FormControlName lets go of control
Call setUpValidators from setupCustomControl. Applying validators needs few more changes:
- FormControlName: ɵngControlUpdate runs before ngOnChanges of element, so setting control up
there would run control's own NG_VALIDATORS before its ngOnInit, and first ngOnChanges of each
validator directive would emit valueChanges and statusChanges during first change detection.
ɵngControlUpdate now only resolves control and ngOnChanges sets it up, same as for
ControlValueAccessor
- required: with FormControlDirective and FormControlName, NgControl also wrote `required` into
RequiredValidator on same element. That cleared static `required`, and Validators.required
turned into directive validator that outlived removeValidators(). setInputOnDirectives now
passes directive to writePredicate and NgControl skips RequiredValidator. Custom control gets
`required` from enabled RequiredValidator or Validators.required under all three directives
- errors: status inputs are read through untracked getters and `errors` was plain field, so
re-validation later in same pass (validator directive's ngOnChanges) left `invalid` and `errors`
stale, and markForCheck during that refresh doesnt re-run view. `errors` is backed by signal now
like `status`, and ngControlUpdate reads both, so errors-only change is bound in same pass, with
`emitEvent: false` too
- _enabled on validator directives is backed by signal too, so change from their ngOnChanges
reaches custom control in same change detection
Fixes#70721
Co-authored-by: leonsenft <[email protected]>
`markAsTouched()` synchronized a pending debounced value only on the
field it was called on. Its descendants were marked as touched, but
their pending values stayed unsynced.
`submit()` marks the root as touched before running the action, so
submitting with Enter while a debounced child still had focus ran the
action with the child's old value. Clicking a submit button hid the bug,
because the click blurs the input first.
This is a regression from #67453. Before it, `submit()` called the
public `markAsTouched()` on each active field, which flushed it.
Flush each field's pending value right after marking it as touched.
Disabled, hidden and readonly fields still aren't marked as touched, but
unlike before #67453 they are flushed too, so their pending value reaches
the model before the action reads it. Below them only fields that already
exist are visited, since a field that was never created can't have a
pending value.
Tested with new specs in `//packages/forms/signals/test/node:test`. The
specs for descendants, `submit()`, an invalid flushed value, a duration
debounce and sibling fields fail without the fix; another checks that
touching a form doesn't create the fields of a hidden subtree.
Fixes#71149
Standalone is the default, so the explicit flag is redundant. Remove the
occurrences added to core, platform-browser, forms and router tests since
the last cleanup.
Add `/* @__PURE__ */` annotations to top-level IIFE initializers in `@angular/core`,
`@angular/forms`, and `@angular/platform-browser` so Closure Compiler and bundlers
can drop them when unused.
Previously, `FieldNodeContext.valueOf` used `result instanceof AbstractControl` to throw `NG1907` when reading an `AbstractControl` inside a regular `form()`. That value reference prevented `AbstractControl` (along with control event classes and validator helpers) from being tree-shaken in applications that only use signal forms.
Introduce an internal symbol-based type guard `ɵisAbstractControl` that checks a private symbol set in `AbstractControl`'s constructor without referencing the `AbstractControl` class value.
Fixes#71621
Ensure that options passed to SignalFormControl (either as the second argument or as the third argument with a schema or undefined) are preserved and correctly forwarded to compatForm and form().
Previously, normalizeFormArgs relied on args.length === 3, causing options passed as the second argument to be misidentified as a schema function. Furthermore, SignalFormControl only forwarded {injector} to compatForm, discarding options such as name.
Prevent convertedParseErrors from leaking reactive dependencies into the caller reactive context during synchronous validation runs, and add a test verifying parse errors propagate when model value remains unchanged.
This updates NgControl to directly evaluate the parseErrors computed signal inside its dynamic validator, rather than waiting for the effect to update a local variable. This allows synchronous validation updates to pick up the fresh parseErrors immediately during setValue, preventing stale states and duplicate valueChanges emissions when the effect runs later.
It also retains the ability for independent parseErrors changes to correctly update the control's validity silently. Calling `markForCheck()` ensures the view is updated even when `statusChanges` does not emit.
Fixes#71127
Create field injectors only when managed metadata needs an injection
context, and destroy only injectors that have already been created.
Plain metadata and built-in synchronous rules otherwise allocate an
unused injector per field, including during removal.
Preserve eager managed metadata creation, the shared field injection
context, and teardown of asynchronous validators.
Fixes#71623
Custom controls implementing `FormValueControl` bound via `[formControl]` or `formControlName` currently bypass `setUpControlValueAccessor`. In `NgControl.ngControlCreate`, incoming values from the custom control model were applied directly to the `FormControl` without checking `control.updateOn`.
This update respects `control.updateOn` by buffering pending values and dirty state when `updateOn` is set to `'blur'` or `'submit'`. Value and validity are committed on `touch` output emissions for `'blur'`, and on form submission for `'submit'`. Programmatic resets also synchronize the reset value to the custom control when pending changes are cleared.
Programmatic `setValue` and `reset` calls now also update `[(ngModel)]` for custom controls, as they do for CVAs.
Expose `required` from `CompatFieldNode` by deriving a signal from the wrapped control's `hasValidator(Validators.required)` state, using the existing control-status signal helper so validator updates and control swaps are observed.
Fixes#68905.
Signal forms are model-driven and do not support pending or uncommitted
values. As a result, non-default `updateOn` options (`blur`, `submit`)
cannot be supported.
This commit adds a dev-mode check in `SignalFormControl` to throw an error
when:
1. An unsupported `updateOn` option is passed directly in options to the
`SignalFormControl` constructor.
2. A non-default `updateOn` option is inherited from a parent `FormGroup`
or `FormArray` via `setParent()`.
Additionally, `SignalFormControl` explicitly overrides `get updateOn()`
to return `'change'`.
Previously, `generate_api_docs(...)` targets lived directly in each
`//packages/**/BUILD.bazel` file (and `render_api_to_html(...)` in
`//tools/manual_api_docs/{blocks,elements}/BUILD.bazel`). Because
`render_api_to_html` validates links against
`//adev/scripts/routes:defined-routes.json`, running wildcard package
builds or tests such as `bazel test //packages/forms/...` pulled in the
`//adev/...` route generation and API manifest dependency graph across
all packages.
Move all framework `generate_api_docs` and manual API `render_api_to_html`
targets into `//adev/src/content/api` alongside `aria`, `cdk`, and `cli`,
leaving only lightweight `files_for_docgen` filegroups in `//packages/...`
and JSON extraction targets in `//tools/manual_api_docs/...`. Remove the
`generate_api_docs` wrapper from `//tools:defaults.bzl` so neither
`//packages/...` nor `//tools/...` loads or depends on `//adev/...`, and
add `//adev/src/content/api:api_docs_test` so `bazel test //adev/...`
explicitly exercises API doc generation and link validation.
The comment said the service installs a CSS transition and listens
for `transitionstart`. Since it was introduced, the service has
installed `@keyframes` animations and listened for `animationstart`.
Describe what the code does, and rename the private
`createTransitionStyle()` to `createAnimationStyle()` to match.
The `debounced()` cycle-error spec had no expectations, and it ended
before the debounced load started, because `debounced()` registers no
pending task. Check the loads and the field's pending and valid state
across the debounce.
The `validateAsync` orphan spec registered abort listeners but never
checked them. Check that removing an item aborts its in-flight load
and leaves the other item's load running.
Avoid repeated option scans when a multi-select receives multiple values
with the default identity comparison. Match registered options against a
Set of requested values and retain the first match for duplicate options.
Keep signed zero distinct, ignore sparse-array holes, and preserve custom
comparator invocation order. Apply all selection writes synchronously and
cover option setters, removal, duplicate identities, and model updates.
- PACKAGE.md: debouncing is supported through the `debounce()` rule, so
remove it from the list of unsupported features.
- Use the `{when}` form of `disabled()` in JSDoc examples instead of the
deprecated function overload.
Replace the runtime-only test with one that also checks
`ThisParameterType` of `valueOf`, `stateOf` and `fieldTreeOf`, so the
test fails to compile if the `this: void` annotation regresses.
Claude-Session: https://claude.ai/code/session_011r2XWZik3FoTLYtMWjWr8P
`valueOf`, `stateOf` and `fieldTreeOf` on the field context are commonly
destructured in logic functions (e.g. `({valueOf}) => valueOf(p.name)`).
Because they were declared with method syntax, `@typescript-eslint/unbound-method`
and oxlint's `typescript/unbound-method` reported a false positive for every
destructured use.
At runtime these members are already safe to destructure: `FieldNodeContext`
binds `stateOf` and `fieldTreeOf` in its constructor and defines `valueOf` as
an arrow function. Declaring `this: void` makes the public types match that
contract. This is a type-only change with no runtime behavior change.
Claude-Session: https://claude.ai/code/session_01VjkGFtQxxE6pd2BoC8wRxh
Even tho reactive forms might be considered legacy now, this fix covers
a real production case.
Prior to this commit, a `formControlName` with no control for it in the
form group crashed in production with a raw `TypeError: Cannot read
properties of null (reading '_rawValidators')`. The error said nothing
about forms or which control was missing, so it was hard to trace back
to the template. A common way to hit it: the template and the form group
are built from the same list but with two different filters, so an item
passes the template's filter but was never given a control.
`AbstractFormDirective.addControl` read `this.form.get(dir.path)` and
passed the result into `_setupWithForm` without a null check. In dev
mode this was still caught earlier, in `setUpControlValueAccessor`
("Cannot find control with path"). In production `ngDevMode` strips that
check away, so the null control reached `setUpValidators`, which
dereferences it right away and threw the bare `TypeError`.
With this fix, `addControl` checks the control first and throws a coded
`RuntimeError` (NG01055), with a docs page on angular.dev. The check is
not gated behind `ngDevMode`, since the crash it prevents is a production
one. The message stays `ngDevMode`-only and lists the sibling controls
that exist at that path, which is usually enough to spot a name mismatch.
Fixes#71155
Removes unnecessary `changeDetection: ChangeDetectionStrategy.Eager` from test components where default `OnPush` change detection works or where state updates can use signals, removes unnecessary `provideZoneChangeDetection()`, replaces `fixture.detectChanges()` with `await fixture.whenStable()` where appropriate, and cleans up redundant `forwardRef`/`CommonModule` imports and unused selectors.
Previously, the blur and input listeners in nativeControlCreate were
registered via host.listenToDom(), which routes through wrapListener and
calls markViewDirty before running the callback. This caused
scheduler.notify() to fire on every blur event, even when the control was
already touched and the signal write was a no-op.
Switch to native addEventListener so that change detection ticks are only
triggered by actual signal changes. Remove the now-unused listenToDom
method from ControlDirectiveHost and its implementation.
The API reference only attaches a `@param` description to a parameter
when the names match. Several APIs documented parameters under a
different name than the one in the signature, so angular.dev rendered
those parameters with an empty description.
Update the JSDoc to use the actual parameter names:
- core: `ViewContainerRef.move()` documented `index` instead of
`currentIndex`.
- core: `inject()` still documented the `flags` parameter, which was
replaced by `options` when `InjectFlags` was removed from the public
API. Use the same description as the other `inject()` overloads.
- core: `twoWayBinding()` documented `eventName` instead of `publicName`.
- common: `Location.subscribe()` documented `value` and `exception`
instead of the `onNext` and `onThrow` callbacks, and didn't document
`onReturn`.
- common/upgrade: `UrlCodec.encodeSearch()`, `decodeSearch()`,
`encodeHash()` and `decodeHash()` documented `path` instead of
`search` or `hash`, and the first `normalize()` overload documented
`path` instead of `href`. Also fix a "has string" typo.
- router: `DefaultTitleStrategy.updateTitle()` documented a `title`
parameter instead of `snapshot`. Also update its description, since
it builds the title from the router state rather than setting a
given value.
- forms: `minDate()` and `maxDate()` documented `minDate` and `maxDate`
instead of `minDateValue` and `maxDateValue`.
Verified by rebuilding the docs with `//adev:build` and checking that
each of these parameters now has a description in the generated API
reference pages, and that no other `@param` name mismatches remain
besides `IterableChanges.forEachOperation` (which documents its
callback's arguments) and the `QueryList` constructor.
A date input reads and writes `Date` values at midnight UTC, which is how
`valueAsDate` behaves. `minDate` and `maxDate` compare against that value
and format the `min` and `max` attributes with UTC getters, so a limit built
from local time (`new Date(2026, 5, 1)` or `new Date()`) is shifted by the
user's UTC offset. Depending on the time zone, the limit date itself is
rejected or the attribute is a day off.
Add a `minDate() and maxDate()` section to the validation guide, which had
none, and note the UTC contract in the JSDoc of `minDate` and `maxDate`.
Point the `@see` links of those two functions at the new section.