@angular/forms 21.1.0-next.4 → 21.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/fesm2022/_structure-chunk.mjs +29 -15
- package/fesm2022/_structure-chunk.mjs.map +1 -1
- package/fesm2022/forms.mjs +133 -132
- package/fesm2022/forms.mjs.map +1 -1
- package/fesm2022/signals-compat.mjs +2 -2
- package/fesm2022/signals.mjs +63 -86
- package/fesm2022/signals.mjs.map +1 -1
- package/package.json +10 -4
- package/resources/code-examples.db +0 -0
- package/types/_structure-chunk.d.ts +57 -74
- package/types/forms.d.ts +26 -9
- package/types/signals-compat.d.ts +2 -2
- package/types/signals.d.ts +155 -145
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.1.0
|
|
3
|
-
* (c) 2010-
|
|
2
|
+
* @license Angular v21.1.0
|
|
3
|
+
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -43,12 +43,12 @@ declare class InteropNgControl implements Pick<NgControl, InteropSharedKeys | 'c
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* Lightweight DI token provided by the {@link
|
|
46
|
+
* Lightweight DI token provided by the {@link FormField} directive.
|
|
47
47
|
*
|
|
48
48
|
* @category control
|
|
49
49
|
* @experimental 21.0.0
|
|
50
50
|
*/
|
|
51
|
-
declare const
|
|
51
|
+
declare const FORM_FIELD: InjectionToken<FormField<unknown>>;
|
|
52
52
|
/**
|
|
53
53
|
* Binds a form `FieldTree` to a UI control that edits it. A UI control can be one of several things:
|
|
54
54
|
* 1. A native HTML input or textarea
|
|
@@ -57,9 +57,9 @@ declare const FIELD: InjectionToken<Field<unknown>>;
|
|
|
57
57
|
* compatibility with reactive forms. Prefer options (1) and (2).
|
|
58
58
|
*
|
|
59
59
|
* This directive has several responsibilities:
|
|
60
|
-
* 1. Two-way binds the field's value with the UI control's value
|
|
61
|
-
* 2. Binds additional forms related state on the field to the UI control (disabled, required, etc.)
|
|
62
|
-
* 3. Relays relevant events on the control to the field (e.g. marks
|
|
60
|
+
* 1. Two-way binds the field state's value with the UI control's value
|
|
61
|
+
* 2. Binds additional forms related state on the field state to the UI control (disabled, required, etc.)
|
|
62
|
+
* 3. Relays relevant events on the control to the field state (e.g. marks touched on blur)
|
|
63
63
|
* 4. Provides a fake `NgControl` that implements a subset of the features available on the
|
|
64
64
|
* reactive forms `NgControl`. This is provided to improve interoperability with controls
|
|
65
65
|
* designed to work with reactive forms. It should not be used by controls written for signal
|
|
@@ -68,10 +68,10 @@ declare const FIELD: InjectionToken<Field<unknown>>;
|
|
|
68
68
|
* @category control
|
|
69
69
|
* @experimental 21.0.0
|
|
70
70
|
*/
|
|
71
|
-
declare class
|
|
71
|
+
declare class FormField<T> {
|
|
72
72
|
readonly element: HTMLElement;
|
|
73
73
|
readonly injector: Injector;
|
|
74
|
-
readonly
|
|
74
|
+
readonly formField: i0.InputSignal<FieldTree<T>>;
|
|
75
75
|
readonly state: i0.Signal<[T] extends [_angular_forms.AbstractControl<any, any, any>] ? CompatFieldState<T, string | number> : FieldState<T, string | number>>;
|
|
76
76
|
readonly [_CONTROL]: {
|
|
77
77
|
readonly create: typeof __controlCreate;
|
|
@@ -82,10 +82,12 @@ declare class Field<T> {
|
|
|
82
82
|
private readonly controlValueAccessors;
|
|
83
83
|
/** A lazily instantiated fake `NgControl`. */
|
|
84
84
|
private interopNgControl;
|
|
85
|
-
/** Lazily instantiates a fake `NgControl` for this field. */
|
|
85
|
+
/** Lazily instantiates a fake `NgControl` for this form field. */
|
|
86
86
|
protected getOrCreateNgControl(): InteropNgControl;
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
/** Focuses this UI control. */
|
|
88
|
+
focus?(): void;
|
|
89
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FormField<any>, never>;
|
|
90
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<FormField<any>, "[formField]", never, { "formField": { "alias": "formField"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
/**
|
|
@@ -377,7 +379,7 @@ type AsyncValidationResult<E extends ValidationError = ValidationError> = Valida
|
|
|
377
379
|
* @category types
|
|
378
380
|
* @experimental 21.0.0
|
|
379
381
|
*/
|
|
380
|
-
type FieldTree<TModel, TKey extends string | number = string | number> = (() => [TModel] extends [AbstractControl] ? CompatFieldState<TModel, TKey> : FieldState<TModel, TKey>) & ([TModel] extends [AbstractControl] ? object : [TModel] extends [
|
|
382
|
+
type FieldTree<TModel, TKey extends string | number = string | number> = (() => [TModel] extends [AbstractControl] ? CompatFieldState<TModel, TKey> : FieldState<TModel, TKey>) & ([TModel] extends [AbstractControl] ? object : [TModel] extends [ReadonlyArray<infer U>] ? ReadonlyArrayLike<MaybeFieldTree<U, number>> : TModel extends Record<string, any> ? Subfields<TModel> : object);
|
|
381
383
|
/**
|
|
382
384
|
* The sub-fields that a user can navigate to from a `FieldTree<TModel>`.
|
|
383
385
|
*
|
|
@@ -480,9 +482,9 @@ interface FieldState<TValue, TKey extends string | number = string | number> ext
|
|
|
480
482
|
*/
|
|
481
483
|
readonly keyInParent: Signal<TKey>;
|
|
482
484
|
/**
|
|
483
|
-
* The {@link
|
|
485
|
+
* The {@link FormField} directives that bind this field to a UI control.
|
|
484
486
|
*/
|
|
485
|
-
readonly
|
|
487
|
+
readonly formFieldBindings: Signal<readonly FormField<unknown>[]>;
|
|
486
488
|
/**
|
|
487
489
|
* Reads a metadata value from the field.
|
|
488
490
|
* @param key The metadata key to read.
|
|
@@ -496,6 +498,11 @@ interface FieldState<TValue, TKey extends string | number = string | number> ext
|
|
|
496
498
|
* @param value Optional value to set to the form. If not passed, the value will not be changed.
|
|
497
499
|
*/
|
|
498
500
|
reset(value?: TValue): void;
|
|
501
|
+
/**
|
|
502
|
+
* Focuses the first UI control in the DOM that is bound to this field state.
|
|
503
|
+
* If no UI control is bound, does nothing.
|
|
504
|
+
*/
|
|
505
|
+
focusBoundControl(): void;
|
|
499
506
|
}
|
|
500
507
|
/**
|
|
501
508
|
* This is FieldState also providing access to the wrapped FormControl.
|
|
@@ -559,7 +566,7 @@ type CompatSchemaPath<TControl extends AbstractControl, TPathKind extends PathKi
|
|
|
559
566
|
*
|
|
560
567
|
* @experimental 21.0.0
|
|
561
568
|
*/
|
|
562
|
-
type SchemaPathTree<TModel, TPathKind extends PathKind = PathKind.Root> = ([TModel] extends [AbstractControl] ? CompatSchemaPath<TModel, TPathKind> : SchemaPath<TModel, SchemaPathRules.Supported, TPathKind>) & (TModel extends AbstractControl ? unknown : TModel extends
|
|
569
|
+
type SchemaPathTree<TModel, TPathKind extends PathKind = PathKind.Root> = ([TModel] extends [AbstractControl] ? CompatSchemaPath<TModel, TPathKind> : SchemaPath<TModel, SchemaPathRules.Supported, TPathKind>) & (TModel extends AbstractControl ? unknown : TModel extends ReadonlyArray<any> ? unknown : TModel extends Record<string, any> ? {
|
|
563
570
|
[K in keyof TModel]: MaybeSchemaPathTree<TModel[K], PathKind.Child>;
|
|
564
571
|
} : unknown);
|
|
565
572
|
/**
|
|
@@ -692,7 +699,7 @@ type TreeValidator<TValue, TPathKind extends PathKind = PathKind.Root> = LogicFn
|
|
|
692
699
|
*
|
|
693
700
|
* @template TValue The type of value stored in the field being validated
|
|
694
701
|
* @template TPathKind The kind of path being validated (root field, child field, or item of an array)
|
|
695
|
-
*
|
|
702
|
+
* @see [Signal Form Validation](/guide/forms/signals/validation)
|
|
696
703
|
* @category types
|
|
697
704
|
* @experimental 21.0.0
|
|
698
705
|
*/
|
|
@@ -938,22 +945,6 @@ declare function standardSchemaError(issue: StandardSchemaV1.Issue, options: Wit
|
|
|
938
945
|
* @experimental 21.0.0
|
|
939
946
|
*/
|
|
940
947
|
declare function standardSchemaError(issue: StandardSchemaV1.Issue, options?: ValidationErrorOptions): WithoutField<StandardSchemaValidationError>;
|
|
941
|
-
/**
|
|
942
|
-
* Create a custom error associated with the target field
|
|
943
|
-
* @param obj The object to create an error from
|
|
944
|
-
*
|
|
945
|
-
* @category validation
|
|
946
|
-
* @experimental 21.0.0
|
|
947
|
-
*/
|
|
948
|
-
declare function customError<E extends Partial<ValidationError.WithField>>(obj: WithField<E>): CustomValidationError;
|
|
949
|
-
/**
|
|
950
|
-
* Create a custom error
|
|
951
|
-
* @param obj The object to create an error from
|
|
952
|
-
*
|
|
953
|
-
* @category validation
|
|
954
|
-
* @experimental 21.0.0
|
|
955
|
-
*/
|
|
956
|
-
declare function customError<E extends Partial<ValidationError.WithField>>(obj?: E): WithoutField<CustomValidationError>;
|
|
957
948
|
/**
|
|
958
949
|
* Common interface for all validation errors.
|
|
959
950
|
*
|
|
@@ -962,6 +953,8 @@ declare function customError<E extends Partial<ValidationError.WithField>>(obj?:
|
|
|
962
953
|
* It's also used by the creation functions to create an instance
|
|
963
954
|
* (e.g. `requiredError`, `minError`, etc.).
|
|
964
955
|
*
|
|
956
|
+
* @see [Signal Form Validation](guide/forms/signals/validation)
|
|
957
|
+
* @see [Signal Form Validation Errors](guide/forms/signals/validation#validation-errors)
|
|
965
958
|
* @category validation
|
|
966
959
|
* @experimental 21.0.0
|
|
967
960
|
*/
|
|
@@ -999,30 +992,9 @@ declare namespace ValidationError {
|
|
|
999
992
|
*/
|
|
1000
993
|
interface WithoutField extends ValidationError {
|
|
1001
994
|
/** The field associated with this error. */
|
|
1002
|
-
readonly
|
|
995
|
+
readonly fieldTree?: never;
|
|
1003
996
|
}
|
|
1004
997
|
}
|
|
1005
|
-
/**
|
|
1006
|
-
* A custom error that may contain additional properties
|
|
1007
|
-
*
|
|
1008
|
-
* @category validation
|
|
1009
|
-
* @experimental 21.0.0
|
|
1010
|
-
*/
|
|
1011
|
-
declare class CustomValidationError implements ValidationError {
|
|
1012
|
-
/** Brand the class to avoid Typescript structural matching */
|
|
1013
|
-
private __brand;
|
|
1014
|
-
/**
|
|
1015
|
-
* Allow the user to attach arbitrary other properties.
|
|
1016
|
-
*/
|
|
1017
|
-
[key: PropertyKey]: unknown;
|
|
1018
|
-
/** Identifies the kind of error. */
|
|
1019
|
-
readonly kind: string;
|
|
1020
|
-
/** The field associated with this error. */
|
|
1021
|
-
readonly fieldTree: FieldTree<unknown>;
|
|
1022
|
-
/** Human readable error message. */
|
|
1023
|
-
readonly message?: string;
|
|
1024
|
-
constructor(options?: ValidationErrorOptions);
|
|
1025
|
-
}
|
|
1026
998
|
/**
|
|
1027
999
|
* Internal version of `NgValidationError`, we create this separately so we can change its type on
|
|
1028
1000
|
* the exported version to a type union of the possible sub-classes.
|
|
@@ -1160,7 +1132,7 @@ type NgValidationError = RequiredValidationError | MinValidationError | MaxValid
|
|
|
1160
1132
|
interface SignalFormsConfig {
|
|
1161
1133
|
/** A map of CSS class names to predicate functions that determine when to apply them. */
|
|
1162
1134
|
classes?: {
|
|
1163
|
-
[className: string]: (state:
|
|
1135
|
+
[className: string]: (state: FormField<unknown>) => boolean;
|
|
1164
1136
|
};
|
|
1165
1137
|
}
|
|
1166
1138
|
/**
|
|
@@ -1192,7 +1164,7 @@ interface Predicate {
|
|
|
1192
1164
|
*
|
|
1193
1165
|
* Consider the following example:
|
|
1194
1166
|
*
|
|
1195
|
-
* ```
|
|
1167
|
+
* ```ts
|
|
1196
1168
|
* const s = schema(p => {
|
|
1197
1169
|
* disabled(p.data);
|
|
1198
1170
|
* applyWhen(p.next, ({valueOf}) => valueOf(p.data) === 1, s);
|
|
@@ -1560,8 +1532,8 @@ declare class FieldNodeState {
|
|
|
1560
1532
|
* Marks this specific field as not touched.
|
|
1561
1533
|
*/
|
|
1562
1534
|
markAsUntouched(): void;
|
|
1563
|
-
/** The {@link
|
|
1564
|
-
readonly
|
|
1535
|
+
/** The {@link FormField} directives that bind this field to a UI control. */
|
|
1536
|
+
readonly formFieldBindings: i0.WritableSignal<readonly FormField<unknown>[]>;
|
|
1565
1537
|
constructor(node: FieldNode);
|
|
1566
1538
|
/**
|
|
1567
1539
|
* Whether this field is considered dirty.
|
|
@@ -1635,8 +1607,8 @@ declare class FieldSubmitState {
|
|
|
1635
1607
|
* and is still in the process of submitting.
|
|
1636
1608
|
*/
|
|
1637
1609
|
readonly selfSubmitting: WritableSignal<boolean>;
|
|
1638
|
-
/**
|
|
1639
|
-
readonly
|
|
1610
|
+
/** Submission errors that are associated with this field. */
|
|
1611
|
+
readonly submissionErrors: WritableSignal<readonly ValidationError.WithField[]>;
|
|
1640
1612
|
constructor(node: FieldNode);
|
|
1641
1613
|
/**
|
|
1642
1614
|
* Whether this form is currently in the process of being submitted.
|
|
@@ -1652,8 +1624,8 @@ interface ValidationState {
|
|
|
1652
1624
|
*/
|
|
1653
1625
|
rawSyncTreeErrors: Signal<ValidationError.WithField[]>;
|
|
1654
1626
|
/**
|
|
1655
|
-
* The full set of synchronous errors for this field, including synchronous tree errors and
|
|
1656
|
-
* errors.
|
|
1627
|
+
* The full set of synchronous errors for this field, including synchronous tree errors and submission
|
|
1628
|
+
* errors. Submission errors are considered "synchronous" because they are imperatively added. From
|
|
1657
1629
|
* the perspective of the field state they are either there or not, they are never in a pending
|
|
1658
1630
|
* state.
|
|
1659
1631
|
*/
|
|
@@ -1762,6 +1734,16 @@ declare class FieldNode implements FieldState<unknown> {
|
|
|
1762
1734
|
readonly fieldProxy: FieldTree<any>;
|
|
1763
1735
|
private readonly pathNode;
|
|
1764
1736
|
constructor(options: FieldNodeOptions);
|
|
1737
|
+
focusBoundControl(): void;
|
|
1738
|
+
/**
|
|
1739
|
+
* Gets the Field directive binding that should be focused when the developer calls
|
|
1740
|
+
* `focusBoundControl` on this node.
|
|
1741
|
+
*
|
|
1742
|
+
* This will prioritize focusable bindings to this node, and if multiple exist, it will return
|
|
1743
|
+
* the first one in the DOM. If no focusable bindings exist on this node, it will return the
|
|
1744
|
+
* first focusable binding in the DOM for any descendant node of this one.
|
|
1745
|
+
*/
|
|
1746
|
+
private getBindingForFocus;
|
|
1765
1747
|
/**
|
|
1766
1748
|
* The `AbortController` for the currently debounced sync, or `undefined` if there is none.
|
|
1767
1749
|
*
|
|
@@ -1786,7 +1768,7 @@ declare class FieldNode implements FieldState<unknown> {
|
|
|
1786
1768
|
get disabledReasons(): Signal<readonly DisabledReason[]>;
|
|
1787
1769
|
get hidden(): Signal<boolean>;
|
|
1788
1770
|
get readonly(): Signal<boolean>;
|
|
1789
|
-
get
|
|
1771
|
+
get formFieldBindings(): Signal<readonly FormField<unknown>[]>;
|
|
1790
1772
|
get submitting(): Signal<boolean>;
|
|
1791
1773
|
get name(): Signal<string>;
|
|
1792
1774
|
get max(): Signal<number | undefined> | undefined;
|
|
@@ -1895,7 +1877,7 @@ declare abstract class FieldNodeStructure {
|
|
|
1895
1877
|
get injector(): DestroyableInjector;
|
|
1896
1878
|
constructor(logic: LogicNode, node: FieldNode, createChildNode: ChildNodeCtor);
|
|
1897
1879
|
/** Gets the child fields of this field. */
|
|
1898
|
-
children():
|
|
1880
|
+
children(): readonly FieldNode[];
|
|
1899
1881
|
/** Retrieve a child `FieldNode` of this node by property key. */
|
|
1900
1882
|
getChild(key: PropertyKey): FieldNode | undefined;
|
|
1901
1883
|
/**
|
|
@@ -2239,7 +2221,7 @@ declare function form<TModel>(model: WritableSignal<TModel>, schemaOrOptions: Sc
|
|
|
2239
2221
|
* ```ts
|
|
2240
2222
|
* const nameForm = form(signal({first: '', last: ''}), (name) => {
|
|
2241
2223
|
* required(name.first);
|
|
2242
|
-
* validate(name.last, ({value}) => !/^[a-z]+$/i.test(value()) ?
|
|
2224
|
+
* validate(name.last, ({value}) => !/^[a-z]+$/i.test(value()) ? {kind: 'alphabet-only'} : undefined);
|
|
2243
2225
|
* });
|
|
2244
2226
|
* nameForm().valid(); // false
|
|
2245
2227
|
* nameForm().value.set({first: 'John', last: 'Doe'});
|
|
@@ -2344,10 +2326,10 @@ declare function applyWhenValue<TValue, TNarrowed extends TValue>(path: SchemaPa
|
|
|
2344
2326
|
*/
|
|
2345
2327
|
declare function applyWhenValue<TValue>(path: SchemaPath<TValue>, predicate: (value: TValue) => boolean, schema: NoInfer<SchemaOrSchemaFn<TValue>>): void;
|
|
2346
2328
|
/**
|
|
2347
|
-
* Submits a given `FieldTree` using the given action function and applies any
|
|
2348
|
-
* resulting from the action to the field.
|
|
2349
|
-
* into the field as a `ValidationError` on the sub-field indicated by the `
|
|
2350
|
-
*
|
|
2329
|
+
* Submits a given `FieldTree` using the given action function and applies any submission errors
|
|
2330
|
+
* resulting from the action to the field. Submission errors returned by the `action` will be integrated
|
|
2331
|
+
* into the field as a `ValidationError` on the sub-field indicated by the `fieldTree` property of the
|
|
2332
|
+
* submission error.
|
|
2351
2333
|
*
|
|
2352
2334
|
* @example
|
|
2353
2335
|
* ```ts
|
|
@@ -2355,8 +2337,9 @@ declare function applyWhenValue<TValue>(path: SchemaPath<TValue>, predicate: (va
|
|
|
2355
2337
|
* const result = await myClient.registerNewUser(registrationForm().value());
|
|
2356
2338
|
* if (result.errorCode === myClient.ErrorCode.USERNAME_TAKEN) {
|
|
2357
2339
|
* return [{
|
|
2358
|
-
*
|
|
2359
|
-
*
|
|
2340
|
+
* fieldTree: registrationForm.username,
|
|
2341
|
+
* kind: 'server',
|
|
2342
|
+
* message: 'Username already taken'
|
|
2360
2343
|
* }];
|
|
2361
2344
|
* }
|
|
2362
2345
|
* return undefined;
|
|
@@ -2370,7 +2353,7 @@ declare function applyWhenValue<TValue>(path: SchemaPath<TValue>, predicate: (va
|
|
|
2370
2353
|
* ```
|
|
2371
2354
|
*
|
|
2372
2355
|
* @param form The field to submit.
|
|
2373
|
-
* @param action An asynchronous action used to submit the field. The action may return
|
|
2356
|
+
* @param action An asynchronous action used to submit the field. The action may return submission
|
|
2374
2357
|
* errors.
|
|
2375
2358
|
* @template TModel The data type of the field being submitted.
|
|
2376
2359
|
*
|
|
@@ -2389,5 +2372,5 @@ declare function submit<TModel>(form: FieldTree<TModel>, action: (form: FieldTre
|
|
|
2389
2372
|
*/
|
|
2390
2373
|
declare function schema<TValue>(fn: SchemaFn<TValue>): Schema<TValue>;
|
|
2391
2374
|
|
|
2392
|
-
export {
|
|
2375
|
+
export { EmailValidationError, FORM_FIELD, FormField, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MaxLengthValidationError, MaxValidationError, MetadataKey, MetadataReducer, MinLengthValidationError, MinValidationError, NgValidationError, PATTERN, PathKind, PatternValidationError, REQUIRED, RequiredValidationError, SchemaPathRules, StandardSchemaValidationError, ValidationError, apply, applyEach, applyWhen, applyWhenValue, createManagedMetadataKey, createMetadataKey, emailError, form, maxError, maxLengthError, metadata, minError, minLengthError, patternError, provideSignalFormsConfig, requiredError, schema, standardSchemaError, submit };
|
|
2393
2376
|
export type { AsyncValidationResult, ChildFieldContext, CompatFieldState, CompatSchemaPath, Debouncer, DisabledReason, FieldContext, FieldState, FieldTree, FieldValidator, FormOptions, ItemFieldContext, ItemType, LogicFn, MaybeFieldTree, MaybeSchemaPathTree, MetadataSetterType, OneOrMany, ReadonlyArrayLike, RootFieldContext, Schema, SchemaFn, SchemaOrSchemaFn, SchemaPath, SchemaPathTree, SignalFormsConfig, Subfields, SubmittedStatus, TreeValidationResult, TreeValidator, ValidationResult, ValidationSuccess, Validator, WithField, WithOptionalField, WithoutField };
|
package/types/forms.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.1.0
|
|
3
|
-
* (c) 2010-
|
|
2
|
+
* @license Angular v21.1.0
|
|
3
|
+
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -1073,7 +1073,7 @@ type ɵFormArrayRawValue<T extends AbstractControl<any>> = ɵTypedOrUntyped<T, A
|
|
|
1073
1073
|
* the `FormArray` directly, as that result in strange and unexpected behavior such
|
|
1074
1074
|
* as broken change detection.
|
|
1075
1075
|
*
|
|
1076
|
-
* @see [FormArray: Dynamic, Homogenous Collections](guide/forms/typed-forms#
|
|
1076
|
+
* @see [FormArray: Dynamic, Homogenous Collections](guide/forms/typed-forms#formarray-dynamic-homogenous-collections)
|
|
1077
1077
|
* @see [Creating dynamic forms](guide/forms/reactive-forms#creating-dynamic-forms)
|
|
1078
1078
|
*
|
|
1079
1079
|
* @publicApi
|
|
@@ -2769,9 +2769,7 @@ declare abstract class AbstractControl<TValue = any, TRawValue extends TValue =
|
|
|
2769
2769
|
*
|
|
2770
2770
|
* @usageNotes
|
|
2771
2771
|
*
|
|
2772
|
-
*
|
|
2773
|
-
*
|
|
2774
|
-
* ```
|
|
2772
|
+
* ```ts
|
|
2775
2773
|
* // Reference to the RequiredValidator
|
|
2776
2774
|
* const ctrl = new FormControl<string | null>('', Validators.required);
|
|
2777
2775
|
* ctrl.removeValidators(Validators.required);
|
|
@@ -2809,9 +2807,7 @@ declare abstract class AbstractControl<TValue = any, TRawValue extends TValue =
|
|
|
2809
2807
|
*
|
|
2810
2808
|
* @usageNotes
|
|
2811
2809
|
*
|
|
2812
|
-
*
|
|
2813
|
-
*
|
|
2814
|
-
* ```
|
|
2810
|
+
* ```ts
|
|
2815
2811
|
* // Reference to the RequiredValidator
|
|
2816
2812
|
* const ctrl = new FormControl<number | null>(0, Validators.required);
|
|
2817
2813
|
* expect(ctrl.hasValidator(Validators.required)).toEqual(true)
|
|
@@ -2867,6 +2863,9 @@ declare abstract class AbstractControl<TValue = any, TRawValue extends TValue =
|
|
|
2867
2863
|
* * `emitEvent`: When true or not supplied (the default), the `events`
|
|
2868
2864
|
* observable emits a `TouchedChangeEvent` with the `touched` property being `true`.
|
|
2869
2865
|
* When false, no events are emitted.
|
|
2866
|
+
*
|
|
2867
|
+
* @see [Managing form control state](guide/forms/reactive-forms#managing-form-control-state)
|
|
2868
|
+
*
|
|
2870
2869
|
*/
|
|
2871
2870
|
markAsTouched(opts?: {
|
|
2872
2871
|
onlySelf?: boolean;
|
|
@@ -2881,6 +2880,9 @@ declare abstract class AbstractControl<TValue = any, TRawValue extends TValue =
|
|
|
2881
2880
|
* * `emitEvent`: When true or not supplied (the default), the `events`
|
|
2882
2881
|
* observable emits a `PristineChangeEvent` with the `pristine` property being `false`.
|
|
2883
2882
|
* When false, no events are emitted.
|
|
2883
|
+
*
|
|
2884
|
+
* @see [Managing form control state](guide/forms/reactive-forms#managing-form-control-state)
|
|
2885
|
+
*
|
|
2884
2886
|
*/
|
|
2885
2887
|
markAllAsDirty(opts?: {
|
|
2886
2888
|
emitEvent?: boolean;
|
|
@@ -2894,6 +2896,9 @@ declare abstract class AbstractControl<TValue = any, TRawValue extends TValue =
|
|
|
2894
2896
|
* * `emitEvent`: When true or not supplied (the default), the `events`
|
|
2895
2897
|
* observable emits a `TouchedChangeEvent` with the `touched` property being `true`.
|
|
2896
2898
|
* When false, no events are emitted.
|
|
2899
|
+
*
|
|
2900
|
+
* @see [Managing form control state](guide/forms/reactive-forms#managing-form-control-state)
|
|
2901
|
+
*
|
|
2897
2902
|
*/
|
|
2898
2903
|
markAllAsTouched(opts?: {
|
|
2899
2904
|
emitEvent?: boolean;
|
|
@@ -2915,6 +2920,9 @@ declare abstract class AbstractControl<TValue = any, TRawValue extends TValue =
|
|
|
2915
2920
|
* * `emitEvent`: When true or not supplied (the default), the `events`
|
|
2916
2921
|
* observable emits a `TouchedChangeEvent` with the `touched` property being `false`.
|
|
2917
2922
|
* When false, no events are emitted.
|
|
2923
|
+
*
|
|
2924
|
+
* @see [Managing form control state](guide/forms/reactive-forms#managing-form-control-state)
|
|
2925
|
+
*
|
|
2918
2926
|
*/
|
|
2919
2927
|
markAsUntouched(opts?: {
|
|
2920
2928
|
onlySelf?: boolean;
|
|
@@ -2935,6 +2943,9 @@ declare abstract class AbstractControl<TValue = any, TRawValue extends TValue =
|
|
|
2935
2943
|
* * `emitEvent`: When true or not supplied (the default), the `events`
|
|
2936
2944
|
* observable emits a `PristineChangeEvent` with the `pristine` property being `false`.
|
|
2937
2945
|
* When false, no events are emitted.
|
|
2946
|
+
*
|
|
2947
|
+
* @see [Managing form control state](guide/forms/reactive-forms#managing-form-control-state)
|
|
2948
|
+
*
|
|
2938
2949
|
*/
|
|
2939
2950
|
markAsDirty(opts?: {
|
|
2940
2951
|
onlySelf?: boolean;
|
|
@@ -2958,6 +2969,9 @@ declare abstract class AbstractControl<TValue = any, TRawValue extends TValue =
|
|
|
2958
2969
|
* * `emitEvent`: When true or not supplied (the default), the `events`
|
|
2959
2970
|
* observable emits a `PristineChangeEvent` with the `pristine` property being `true`.
|
|
2960
2971
|
* When false, no events are emitted.
|
|
2972
|
+
*
|
|
2973
|
+
* @see [Managing form control state](guide/forms/reactive-forms#managing-form-control-state)
|
|
2974
|
+
*
|
|
2961
2975
|
*/
|
|
2962
2976
|
markAsPristine(opts?: {
|
|
2963
2977
|
onlySelf?: boolean;
|
|
@@ -3064,6 +3078,9 @@ declare abstract class AbstractControl<TValue = any, TRawValue extends TValue =
|
|
|
3064
3078
|
* `valueChanges` and `events`
|
|
3065
3079
|
* observables emit events with the latest status and value when the control is updated.
|
|
3066
3080
|
* When false, no events are emitted.
|
|
3081
|
+
*
|
|
3082
|
+
* @see [Understanding propagation control](guide/forms/reactive-forms#understanding-event-emission)
|
|
3083
|
+
*
|
|
3067
3084
|
*/
|
|
3068
3085
|
updateValueAndValidity(opts?: {
|
|
3069
3086
|
onlySelf?: boolean;
|