mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
docs: remove error mentions in signal forms docs
`error` no longer exists and is called `validate`
(cherry picked from commit 800b01f5a1)
This commit is contained in:
parent
2019940ddc
commit
eea81c2733
1 changed files with 1 additions and 17 deletions
|
|
@ -155,7 +155,7 @@ export function form<TModel>(
|
|||
* ```
|
||||
* const nameForm = form(signal({first: '', last: ''}), (name) => {
|
||||
* required(name.first);
|
||||
* error(name.last, ({value}) => !/^[a-z]+$/i.test(value()), 'Alphabet characters only');
|
||||
* validate(name.last, ({value}) => !/^[a-z]+$/i.test(value()) ? customError({kind: 'alphabet-only'}) : undefined);
|
||||
* });
|
||||
* nameForm().valid(); // false
|
||||
* nameForm().value.set({first: 'John', last: 'Doe'});
|
||||
|
|
@ -205,22 +205,6 @@ export function form<TModel>(...args: any[]): FieldTree<TModel> {
|
|||
* });
|
||||
* ```
|
||||
*
|
||||
* When binding logic to the array items, the `FieldTree` for the array item is passed as an
|
||||
* additional argument. This can be used to reference other properties on the item.
|
||||
*
|
||||
* @example
|
||||
* ```
|
||||
* const namesForm = form(signal([{first: '', last: ''}]), (names) => {
|
||||
* applyEach(names, (name) => {
|
||||
* error(
|
||||
* name.last,
|
||||
* (value, nameField) => value === nameField.first().value(),
|
||||
* 'Last name must be different than first name',
|
||||
* );
|
||||
* });
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param path The target path for an array field whose items the schema will be applied to.
|
||||
* @param schema A schema for an element of the array, or function that binds logic to an
|
||||
* element of the array.
|
||||
|
|
|
|||
Loading…
Reference in a new issue