You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ca4e34e
Browse filesBrowse the repository at this point in the historyBrowse files
docs(forms): fix broken snippets and wrong statements in the signal forms guides
- async-operations: return headers and timeout from the `validateHttp`
`request` function (they are `HttpResourceRequest` properties, not
`httpResource` options), and fix the invalid object literal in the
`parse` example.
- validation: remove a stray `|` from a component snippet, fix the
"multiple errors" example (`a@b` is a valid email address for the
`email()` validator, `a@` isn't), rename `field` to `fieldTree` in the
`FieldContext` table, add the missing `signal` import, use one zod
import style, and clarify that dynamic schemas are passed as a function.
- custom-controls: `DisabledReason` exposes `fieldTree`, not `field`.
- migration: use `extractValue()` to get the whole form value instead of
building it manually, and fix the expected output.
- form-logic: refer to the `FormField` directive by name, release the
timer when the `debounce` example is aborted, and add the missing
`form` import.
- comparison example: submit through `FormRoot` and a `submission`
action, so the page no longer reloads on submit.
TIP: See the [httpResource API documentation](api/common/http/httpResource) for all available options.
241
+
TIP: See the [`HttpResourceRequest` API documentation](api/common/http/HttpResourceRequest) for all available request properties, and the [httpResource API documentation](api/common/http/httpResource) for the `options` parameter.
Copy file name to clipboardExpand all lines: adev/src/content/guide/forms/signals/custom-controls.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -175,7 +175,7 @@ Control whether users can interact with your field:
175
175
|`readonly`| Whether the field is readonly (visible but not editable) |
176
176
|`hidden`| Whether the field is hidden from view |
177
177
178
-
NOTE: `disabledReasons` is an array of `DisabledReason` objects. Each object has a `field` property (reference to the field tree) and an optional `message` property. Access the message via `reason.message`.
178
+
NOTE: `disabledReasons` is an array of `DisabledReason` objects. Each object has a `fieldTree` property (reference to the field tree) and an optional `message` property. Access the message via `reason.message`.
Copy file name to clipboardExpand all lines: adev/src/content/guide/forms/signals/form-logic.md
+14-6Lines changed: 14 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -262,7 +262,7 @@ export class Profile {
262
262
263
263
## Display uneditable fields with `readonly()`
264
264
265
-
The `readonly()` rule prevents users from updating a field. The `[FormField]` directive automatically binds this state to the HTML `readonly` attribute, which prevents editing while still allowing users to focus and select text.
265
+
The `readonly()` rule prevents users from updating a field. The `FormField` directive automatically binds this state to the HTML `readonly` attribute, which prevents editing while still allowing users to focus and select text.
If the email field is empty, only the `required()` error appears. If the user types "a@b", both `email()` and `minLength()` errors appear. All validation rules run - validation doesn't stop after the first failure.
438
+
If the email field is empty, only the `required()` error appears. If the user types "a@", both `email()` and `minLength()` errors appear. All validation rules run - validation doesn't stop after the first failure.
439
439
440
440
TIP: Use the `touched() && invalid()` pattern in your templates to prevent errors from appearing before users have interacted with a field. For comprehensive guidance on displaying validation errors, see the [Field State Management guide](guide/forms/signals/field-state-management#conditional-error-display).
441
441
@@ -492,7 +492,7 @@ The validator function receives a `FieldContext` object with:
|`value`| Signal | Signal containing the current field value |
494
494
|`state`| FieldState | The field state reference |
495
-
|`field`| FieldTree | The field tree reference |
495
+
|`fieldTree`| FieldTree | The field tree reference |
496
496
|`valueOf()`| Method | Get the value of another field by path |
497
497
|`stateOf()`| Method | Get the state of another field by path |
498
498
|`fieldTreeOf()`| Method | Get the field tree of another field by path |
@@ -668,7 +668,7 @@ import {Component, signal} from '@angular/core';
668
668
import {form, FormField, required, validateHttp} from '@angular/forms/signals';
669
669
670
670
@Component({
671
-
selector: 'app-username-form',|
671
+
selector: 'app-username-form',
672
672
imports: [FormField],
673
673
template: `
674
674
<form novalidate>
@@ -734,6 +734,7 @@ The `valid()` signal returns `false` while validation is pending, even if there
734
734
Signal Forms have built-in support for libraries that conform to [Standard Schema](https://standardschema.dev/) like [Zod](https://zod.dev/) or [Valibot](https://valibot.dev/). The integration is provided via the `validateStandardSchema` function. This allows you to use existing schemas while maintaining Signal Forms' reactive validation benefits.
You can pass a signal instead of a static schema so the validation schema updates automatically when its dependencies change.
755
+
Instead of a static schema, you can pass a function that returns the schema. The validation then updates automatically when the signals read by the function change.
755
756
756
757
```angular-ts
757
758
import {Component, computed, signal} from '@angular/core';
758
759
import {form, FormField, validateStandardSchema} from '@angular/forms/signals';
0 commit comments