UNPKG

201 kBTypeScriptView Raw
1/**
2 * @license Angular v17.3.5
3 * (c) 2010-2024 Google LLC. https://angular.io/
4 * License: MIT
5 */
6
7
8import { AfterViewInit } from '@angular/core';
9import { ChangeDetectorRef } from '@angular/core';
10import { ElementRef } from '@angular/core';
11import { EventEmitter } from '@angular/core';
12import * as i0 from '@angular/core';
13import { InjectionToken } from '@angular/core';
14import { Injector } from '@angular/core';
15import { ModuleWithProviders } from '@angular/core';
16import { Observable } from 'rxjs';
17import { OnChanges } from '@angular/core';
18import { OnDestroy } from '@angular/core';
19import { OnInit } from '@angular/core';
20import { Provider } from '@angular/core';
21import { Renderer2 } from '@angular/core';
22import { SimpleChanges } from '@angular/core';
23import { Type } from '@angular/core';
24import { Version } from '@angular/core';
25
26/**
27 * This is the base class for `FormControl`, `FormGroup`, and `FormArray`.
28 *
29 * It provides some of the shared behavior that all controls and groups of controls have, like
30 * running validators, calculating status, and resetting state. It also defines the properties
31 * that are shared between all sub-classes, like `value`, `valid`, and `dirty`. It shouldn't be
32 * instantiated directly.
33 *
34 * The first type parameter TValue represents the value type of the control (`control.value`).
35 * The optional type parameter TRawValue represents the raw value type (`control.getRawValue()`).
36 *
37 * @see [Forms Guide](/guide/forms)
38 * @see [Reactive Forms Guide](/guide/reactive-forms)
39 * @see [Dynamic Forms Guide](/guide/dynamic-form)
40 *
41 * @publicApi
42 */
43export declare abstract class AbstractControl<TValue = any, TRawValue extends TValue = TValue> {
44 private _parent;
45 private _asyncValidationSubscription;
46 /**
47 * The current value of the control.
48 *
49 * * For a `FormControl`, the current value.
50 * * For an enabled `FormGroup`, the values of enabled controls as an object
51 * with a key-value pair for each member of the group.
52 * * For a disabled `FormGroup`, the values of all controls as an object
53 * with a key-value pair for each member of the group.
54 * * For a `FormArray`, the values of enabled controls as an array.
55 *
56 */
57 readonly value: TValue;
58 /**
59 * Initialize the AbstractControl instance.
60 *
61 * @param validators The function or array of functions that is used to determine the validity of
62 * this control synchronously.
63 * @param asyncValidators The function or array of functions that is used to determine validity of
64 * this control asynchronously.
65 */
66 constructor(validators: ValidatorFn | ValidatorFn[] | null, asyncValidators: AsyncValidatorFn | AsyncValidatorFn[] | null);
67 /**
68 * Returns the function that is used to determine the validity of this control synchronously.
69 * If multiple validators have been added, this will be a single composed function.
70 * See `Validators.compose()` for additional information.
71 */
72 get validator(): ValidatorFn | null;
73 set validator(validatorFn: ValidatorFn | null);
74 /**
75 * Returns the function that is used to determine the validity of this control asynchronously.
76 * If multiple validators have been added, this will be a single composed function.
77 * See `Validators.compose()` for additional information.
78 */
79 get asyncValidator(): AsyncValidatorFn | null;
80 set asyncValidator(asyncValidatorFn: AsyncValidatorFn | null);
81 /**
82 * The parent control.
83 */
84 get parent(): FormGroup | FormArray | null;
85 /**
86 * The validation status of the control.
87 *
88 * @see {@link FormControlStatus}
89 *
90 * These status values are mutually exclusive, so a control cannot be
91 * both valid AND invalid or invalid AND disabled.
92 */
93 readonly status: FormControlStatus;
94 /**
95 * A control is `valid` when its `status` is `VALID`.
96 *
97 * @see {@link AbstractControl.status}
98 *
99 * @returns True if the control has passed all of its validation tests,
100 * false otherwise.
101 */
102 get valid(): boolean;
103 /**
104 * A control is `invalid` when its `status` is `INVALID`.
105 *
106 * @see {@link AbstractControl.status}
107 *
108 * @returns True if this control has failed one or more of its validation checks,
109 * false otherwise.
110 */
111 get invalid(): boolean;
112 /**
113 * A control is `pending` when its `status` is `PENDING`.
114 *
115 * @see {@link AbstractControl.status}
116 *
117 * @returns True if this control is in the process of conducting a validation check,
118 * false otherwise.
119 */
120 get pending(): boolean;
121 /**
122 * A control is `disabled` when its `status` is `DISABLED`.
123 *
124 * Disabled controls are exempt from validation checks and
125 * are not included in the aggregate value of their ancestor
126 * controls.
127 *
128 * @see {@link AbstractControl.status}
129 *
130 * @returns True if the control is disabled, false otherwise.
131 */
132 get disabled(): boolean;
133 /**
134 * A control is `enabled` as long as its `status` is not `DISABLED`.
135 *
136 * @returns True if the control has any status other than 'DISABLED',
137 * false if the status is 'DISABLED'.
138 *
139 * @see {@link AbstractControl.status}
140 *
141 */
142 get enabled(): boolean;
143 /**
144 * An object containing any errors generated by failing validation,
145 * or null if there are no errors.
146 */
147 readonly errors: ValidationErrors | null;
148 /**
149 * A control is `pristine` if the user has not yet changed
150 * the value in the UI.
151 *
152 * @returns True if the user has not yet changed the value in the UI; compare `dirty`.
153 * Programmatic changes to a control's value do not mark it dirty.
154 */
155 readonly pristine: boolean;
156 /**
157 * A control is `dirty` if the user has changed the value
158 * in the UI.
159 *
160 * @returns True if the user has changed the value of this control in the UI; compare `pristine`.
161 * Programmatic changes to a control's value do not mark it dirty.
162 */
163 get dirty(): boolean;
164 /**
165 * True if the control is marked as `touched`.
166 *
167 * A control is marked `touched` once the user has triggered
168 * a `blur` event on it.
169 */
170 readonly touched: boolean;
171 /**
172 * True if the control has not been marked as touched
173 *
174 * A control is `untouched` if the user has not yet triggered
175 * a `blur` event on it.
176 */
177 get untouched(): boolean;
178 /**
179 * A multicasting observable that emits an event every time the value of the control changes, in
180 * the UI or programmatically. It also emits an event each time you call enable() or disable()
181 * without passing along {emitEvent: false} as a function argument.
182 *
183 * **Note**: the emit happens right after a value of this control is updated. The value of a
184 * parent control (for example if this FormControl is a part of a FormGroup) is updated later, so
185 * accessing a value of a parent control (using the `value` property) from the callback of this
186 * event might result in getting a value that has not been updated yet. Subscribe to the
187 * `valueChanges` event of the parent control instead.
188 */
189 readonly valueChanges: Observable<TValue>;
190 /**
191 * A multicasting observable that emits an event every time the validation `status` of the control
192 * recalculates.
193 *
194 * @see {@link FormControlStatus}
195 * @see {@link AbstractControl.status}
196 *
197 */
198 readonly statusChanges: Observable<FormControlStatus>;
199 /**
200 * Reports the update strategy of the `AbstractControl` (meaning
201 * the event on which the control updates itself).
202 * Possible values: `'change'` | `'blur'` | `'submit'`
203 * Default value: `'change'`
204 */
205 get updateOn(): FormHooks;
206 /**
207 * Sets the synchronous validators that are active on this control. Calling
208 * this overwrites any existing synchronous validators.
209 *
210 * When you add or remove a validator at run time, you must call
211 * `updateValueAndValidity()` for the new validation to take effect.
212 *
213 * If you want to add a new validator without affecting existing ones, consider
214 * using `addValidators()` method instead.
215 */
216 setValidators(validators: ValidatorFn | ValidatorFn[] | null): void;
217 /**
218 * Sets the asynchronous validators that are active on this control. Calling this
219 * overwrites any existing asynchronous validators.
220 *
221 * When you add or remove a validator at run time, you must call
222 * `updateValueAndValidity()` for the new validation to take effect.
223 *
224 * If you want to add a new validator without affecting existing ones, consider
225 * using `addAsyncValidators()` method instead.
226 */
227 setAsyncValidators(validators: AsyncValidatorFn | AsyncValidatorFn[] | null): void;
228 /**
229 * Add a synchronous validator or validators to this control, without affecting other validators.
230 *
231 * When you add or remove a validator at run time, you must call
232 * `updateValueAndValidity()` for the new validation to take effect.
233 *
234 * Adding a validator that already exists will have no effect. If duplicate validator functions
235 * are present in the `validators` array, only the first instance would be added to a form
236 * control.
237 *
238 * @param validators The new validator function or functions to add to this control.
239 */
240 addValidators(validators: ValidatorFn | ValidatorFn[]): void;
241 /**
242 * Add an asynchronous validator or validators to this control, without affecting other
243 * validators.
244 *
245 * When you add or remove a validator at run time, you must call
246 * `updateValueAndValidity()` for the new validation to take effect.
247 *
248 * Adding a validator that already exists will have no effect.
249 *
250 * @param validators The new asynchronous validator function or functions to add to this control.
251 */
252 addAsyncValidators(validators: AsyncValidatorFn | AsyncValidatorFn[]): void;
253 /**
254 * Remove a synchronous validator from this control, without affecting other validators.
255 * Validators are compared by function reference; you must pass a reference to the exact same
256 * validator function as the one that was originally set. If a provided validator is not found,
257 * it is ignored.
258 *
259 * @usageNotes
260 *
261 * ### Reference to a ValidatorFn
262 *
263 * ```
264 * // Reference to the RequiredValidator
265 * const ctrl = new FormControl<string | null>('', Validators.required);
266 * ctrl.removeValidators(Validators.required);
267 *
268 * // Reference to anonymous function inside MinValidator
269 * const minValidator = Validators.min(3);
270 * const ctrl = new FormControl<string | null>('', minValidator);
271 * expect(ctrl.hasValidator(minValidator)).toEqual(true)
272 * expect(ctrl.hasValidator(Validators.min(3))).toEqual(false)
273 *
274 * ctrl.removeValidators(minValidator);
275 * ```
276 *
277 * When you add or remove a validator at run time, you must call
278 * `updateValueAndValidity()` for the new validation to take effect.
279 *
280 * @param validators The validator or validators to remove.
281 */
282 removeValidators(validators: ValidatorFn | ValidatorFn[]): void;
283 /**
284 * Remove an asynchronous validator from this control, without affecting other validators.
285 * Validators are compared by function reference; you must pass a reference to the exact same
286 * validator function as the one that was originally set. If a provided validator is not found, it
287 * is ignored.
288 *
289 * When you add or remove a validator at run time, you must call
290 * `updateValueAndValidity()` for the new validation to take effect.
291 *
292 * @param validators The asynchronous validator or validators to remove.
293 */
294 removeAsyncValidators(validators: AsyncValidatorFn | AsyncValidatorFn[]): void;
295 /**
296 * Check whether a synchronous validator function is present on this control. The provided
297 * validator must be a reference to the exact same function that was provided.
298 *
299 * @usageNotes
300 *
301 * ### Reference to a ValidatorFn
302 *
303 * ```
304 * // Reference to the RequiredValidator
305 * const ctrl = new FormControl<number | null>(0, Validators.required);
306 * expect(ctrl.hasValidator(Validators.required)).toEqual(true)
307 *
308 * // Reference to anonymous function inside MinValidator
309 * const minValidator = Validators.min(3);
310 * const ctrl = new FormControl<number | null>(0, minValidator);
311 * expect(ctrl.hasValidator(minValidator)).toEqual(true)
312 * expect(ctrl.hasValidator(Validators.min(3))).toEqual(false)
313 * ```
314 *
315 * @param validator The validator to check for presence. Compared by function reference.
316 * @returns Whether the provided validator was found on this control.
317 */
318 hasValidator(validator: ValidatorFn): boolean;
319 /**
320 * Check whether an asynchronous validator function is present on this control. The provided
321 * validator must be a reference to the exact same function that was provided.
322 *
323 * @param validator The asynchronous validator to check for presence. Compared by function
324 * reference.
325 * @returns Whether the provided asynchronous validator was found on this control.
326 */
327 hasAsyncValidator(validator: AsyncValidatorFn): boolean;
328 /**
329 * Empties out the synchronous validator list.
330 *
331 * When you add or remove a validator at run time, you must call
332 * `updateValueAndValidity()` for the new validation to take effect.
333 *
334 */
335 clearValidators(): void;
336 /**
337 * Empties out the async validator list.
338 *
339 * When you add or remove a validator at run time, you must call
340 * `updateValueAndValidity()` for the new validation to take effect.
341 *
342 */
343 clearAsyncValidators(): void;
344 /**
345 * Marks the control as `touched`. A control is touched by focus and
346 * blur events that do not change the value.
347 *
348 * @see {@link markAsUntouched()}
349 * @see {@link markAsDirty()}
350 * @see {@link markAsPristine()}
351 *
352 * @param opts Configuration options that determine how the control propagates changes
353 * and emits events after marking is applied.
354 * * `onlySelf`: When true, mark only this control. When false or not supplied,
355 * marks all direct ancestors. Default is false.
356 */
357 markAsTouched(opts?: {
358 onlySelf?: boolean;
359 }): void;
360 /**
361 * Marks the control and all its descendant controls as `touched`.
362 * @see {@link markAsTouched()}
363 */
364 markAllAsTouched(): void;
365 /**
366 * Marks the control as `untouched`.
367 *
368 * If the control has any children, also marks all children as `untouched`
369 * and recalculates the `touched` status of all parent controls.
370 *
371 * @see {@link markAsTouched()}
372 * @see {@link markAsDirty()}
373 * @see {@link markAsPristine()}
374 *
375 * @param opts Configuration options that determine how the control propagates changes
376 * and emits events after the marking is applied.
377 * * `onlySelf`: When true, mark only this control. When false or not supplied,
378 * marks all direct ancestors. Default is false.
379 */
380 markAsUntouched(opts?: {
381 onlySelf?: boolean;
382 }): void;
383 /**
384 * Marks the control as `dirty`. A control becomes dirty when
385 * the control's value is changed through the UI; compare `markAsTouched`.
386 *
387 * @see {@link markAsTouched()}
388 * @see {@link markAsUntouched()}
389 * @see {@link markAsPristine()}
390 *
391 * @param opts Configuration options that determine how the control propagates changes
392 * and emits events after marking is applied.
393 * * `onlySelf`: When true, mark only this control. When false or not supplied,
394 * marks all direct ancestors. Default is false.
395 */
396 markAsDirty(opts?: {
397 onlySelf?: boolean;
398 }): void;
399 /**
400 * Marks the control as `pristine`.
401 *
402 * If the control has any children, marks all children as `pristine`,
403 * and recalculates the `pristine` status of all parent
404 * controls.
405 *
406 * @see {@link markAsTouched()}
407 * @see {@link markAsUntouched()}
408 * @see {@link markAsDirty()}
409 *
410 * @param opts Configuration options that determine how the control emits events after
411 * marking is applied.
412 * * `onlySelf`: When true, mark only this control. When false or not supplied,
413 * marks all direct ancestors. Default is false.
414 */
415 markAsPristine(opts?: {
416 onlySelf?: boolean;
417 }): void;
418 /**
419 * Marks the control as `pending`.
420 *
421 * A control is pending while the control performs async validation.
422 *
423 * @see {@link AbstractControl.status}
424 *
425 * @param opts Configuration options that determine how the control propagates changes and
426 * emits events after marking is applied.
427 * * `onlySelf`: When true, mark only this control. When false or not supplied,
428 * marks all direct ancestors. Default is false.
429 * * `emitEvent`: When true or not supplied (the default), the `statusChanges`
430 * observable emits an event with the latest status the control is marked pending.
431 * When false, no events are emitted.
432 *
433 */
434 markAsPending(opts?: {
435 onlySelf?: boolean;
436 emitEvent?: boolean;
437 }): void;
438 /**
439 * Disables the control. This means the control is exempt from validation checks and
440 * excluded from the aggregate value of any parent. Its status is `DISABLED`.
441 *
442 * If the control has children, all children are also disabled.
443 *
444 * @see {@link AbstractControl.status}
445 *
446 * @param opts Configuration options that determine how the control propagates
447 * changes and emits events after the control is disabled.
448 * * `onlySelf`: When true, mark only this control. When false or not supplied,
449 * marks all direct ancestors. Default is false.
450 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
451 * `valueChanges`
452 * observables emit events with the latest status and value when the control is disabled.
453 * When false, no events are emitted.
454 */
455 disable(opts?: {
456 onlySelf?: boolean;
457 emitEvent?: boolean;
458 }): void;
459 /**
460 * Enables the control. This means the control is included in validation checks and
461 * the aggregate value of its parent. Its status recalculates based on its value and
462 * its validators.
463 *
464 * By default, if the control has children, all children are enabled.
465 *
466 * @see {@link AbstractControl.status}
467 *
468 * @param opts Configure options that control how the control propagates changes and
469 * emits events when marked as untouched
470 * * `onlySelf`: When true, mark only this control. When false or not supplied,
471 * marks all direct ancestors. Default is false.
472 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
473 * `valueChanges`
474 * observables emit events with the latest status and value when the control is enabled.
475 * When false, no events are emitted.
476 */
477 enable(opts?: {
478 onlySelf?: boolean;
479 emitEvent?: boolean;
480 }): void;
481 private _updateAncestors;
482 /**
483 * Sets the parent of the control
484 *
485 * @param parent The new parent.
486 */
487 setParent(parent: FormGroup | FormArray | null): void;
488 /**
489 * Sets the value of the control. Abstract method (implemented in sub-classes).
490 */
491 abstract setValue(value: TRawValue, options?: Object): void;
492 /**
493 * Patches the value of the control. Abstract method (implemented in sub-classes).
494 */
495 abstract patchValue(value: TValue, options?: Object): void;
496 /**
497 * Resets the control. Abstract method (implemented in sub-classes).
498 */
499 abstract reset(value?: TValue, options?: Object): void;
500 /**
501 * The raw value of this control. For most control implementations, the raw value will include
502 * disabled children.
503 */
504 getRawValue(): any;
505 /**
506 * Recalculates the value and validation status of the control.
507 *
508 * By default, it also updates the value and validity of its ancestors.
509 *
510 * @param opts Configuration options determine how the control propagates changes and emits events
511 * after updates and validity checks are applied.
512 * * `onlySelf`: When true, only update this control. When false or not supplied,
513 * update all direct ancestors. Default is false.
514 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
515 * `valueChanges`
516 * observables emit events with the latest status and value when the control is updated.
517 * When false, no events are emitted.
518 */
519 updateValueAndValidity(opts?: {
520 onlySelf?: boolean;
521 emitEvent?: boolean;
522 }): void;
523 private _setInitialStatus;
524 private _runValidator;
525 private _runAsyncValidator;
526 private _cancelExistingSubscription;
527 /**
528 * Sets errors on a form control when running validations manually, rather than automatically.
529 *
530 * Calling `setErrors` also updates the validity of the parent control.
531 *
532 * @param opts Configuration options that determine how the control propagates
533 * changes and emits events after the control errors are set.
534 * * `emitEvent`: When true or not supplied (the default), the `statusChanges`
535 * observable emits an event after the errors are set.
536 *
537 * @usageNotes
538 *
539 * ### Manually set the errors for a control
540 *
541 * ```
542 * const login = new FormControl('someLogin');
543 * login.setErrors({
544 * notUnique: true
545 * });
546 *
547 * expect(login.valid).toEqual(false);
548 * expect(login.errors).toEqual({ notUnique: true });
549 *
550 * login.setValue('someOtherLogin');
551 *
552 * expect(login.valid).toEqual(true);
553 * ```
554 */
555 setErrors(errors: ValidationErrors | null, opts?: {
556 emitEvent?: boolean;
557 }): void;
558 /**
559 * Retrieves a child control given the control's name or path.
560 *
561 * This signature for get supports strings and `const` arrays (`.get(['foo', 'bar'] as const)`).
562 */
563 get<P extends string | (readonly (string | number)[])>(path: P): AbstractControl<ɵGetProperty<TRawValue, P>> | null;
564 /**
565 * Retrieves a child control given the control's name or path.
566 *
567 * This signature for `get` supports non-const (mutable) arrays. Inferred type
568 * information will not be as robust, so prefer to pass a `readonly` array if possible.
569 */
570 get<P extends string | Array<string | number>>(path: P): AbstractControl<ɵGetProperty<TRawValue, P>> | null;
571 /**
572 * @description
573 * Reports error data for the control with the given path.
574 *
575 * @param errorCode The code of the error to check
576 * @param path A list of control names that designates how to move from the current control
577 * to the control that should be queried for errors.
578 *
579 * @usageNotes
580 * For example, for the following `FormGroup`:
581 *
582 * ```
583 * form = new FormGroup({
584 * address: new FormGroup({ street: new FormControl() })
585 * });
586 * ```
587 *
588 * The path to the 'street' control from the root form would be 'address' -> 'street'.
589 *
590 * It can be provided to this method in one of two formats:
591 *
592 * 1. An array of string control names, e.g. `['address', 'street']`
593 * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
594 *
595 * @returns error data for that particular error. If the control or error is not present,
596 * null is returned.
597 */
598 getError(errorCode: string, path?: Array<string | number> | string): any;
599 /**
600 * @description
601 * Reports whether the control with the given path has the error specified.
602 *
603 * @param errorCode The code of the error to check
604 * @param path A list of control names that designates how to move from the current control
605 * to the control that should be queried for errors.
606 *
607 * @usageNotes
608 * For example, for the following `FormGroup`:
609 *
610 * ```
611 * form = new FormGroup({
612 * address: new FormGroup({ street: new FormControl() })
613 * });
614 * ```
615 *
616 * The path to the 'street' control from the root form would be 'address' -> 'street'.
617 *
618 * It can be provided to this method in one of two formats:
619 *
620 * 1. An array of string control names, e.g. `['address', 'street']`
621 * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
622 *
623 * If no path is given, this method checks for the error on the current control.
624 *
625 * @returns whether the given error is present in the control at the given path.
626 *
627 * If the control is not present, false is returned.
628 */
629 hasError(errorCode: string, path?: Array<string | number> | string): boolean;
630 /**
631 * Retrieves the top-level ancestor of this control.
632 */
633 get root(): AbstractControl;
634 private _calculateStatus;
635 /**
636 * Internal implementation of the `setValidators` method. Needs to be separated out into a
637 * different method, because it is called in the constructor and it can break cases where
638 * a control is extended.
639 */
640 private _assignValidators;
641 /**
642 * Internal implementation of the `setAsyncValidators` method. Needs to be separated out into a
643 * different method, because it is called in the constructor and it can break cases where
644 * a control is extended.
645 */
646 private _assignAsyncValidators;
647}
648
649/**
650 * @description
651 * Base class for control directives.
652 *
653 * This class is only used internally in the `ReactiveFormsModule` and the `FormsModule`.
654 *
655 * @publicApi
656 */
657export declare abstract class AbstractControlDirective {
658 /**
659 * @description
660 * A reference to the underlying control.
661 *
662 * @returns the control that backs this directive. Most properties fall through to that instance.
663 */
664 abstract get control(): AbstractControl | null;
665 /**
666 * @description
667 * Reports the value of the control if it is present, otherwise null.
668 */
669 get value(): any;
670 /**
671 * @description
672 * Reports whether the control is valid. A control is considered valid if no
673 * validation errors exist with the current value.
674 * If the control is not present, null is returned.
675 */
676 get valid(): boolean | null;
677 /**
678 * @description
679 * Reports whether the control is invalid, meaning that an error exists in the input value.
680 * If the control is not present, null is returned.
681 */
682 get invalid(): boolean | null;
683 /**
684 * @description
685 * Reports whether a control is pending, meaning that async validation is occurring and
686 * errors are not yet available for the input value. If the control is not present, null is
687 * returned.
688 */
689 get pending(): boolean | null;
690 /**
691 * @description
692 * Reports whether the control is disabled, meaning that the control is disabled
693 * in the UI and is exempt from validation checks and excluded from aggregate
694 * values of ancestor controls. If the control is not present, null is returned.
695 */
696 get disabled(): boolean | null;
697 /**
698 * @description
699 * Reports whether the control is enabled, meaning that the control is included in ancestor
700 * calculations of validity or value. If the control is not present, null is returned.
701 */
702 get enabled(): boolean | null;
703 /**
704 * @description
705 * Reports the control's validation errors. If the control is not present, null is returned.
706 */
707 get errors(): ValidationErrors | null;
708 /**
709 * @description
710 * Reports whether the control is pristine, meaning that the user has not yet changed
711 * the value in the UI. If the control is not present, null is returned.
712 */
713 get pristine(): boolean | null;
714 /**
715 * @description
716 * Reports whether the control is dirty, meaning that the user has changed
717 * the value in the UI. If the control is not present, null is returned.
718 */
719 get dirty(): boolean | null;
720 /**
721 * @description
722 * Reports whether the control is touched, meaning that the user has triggered
723 * a `blur` event on it. If the control is not present, null is returned.
724 */
725 get touched(): boolean | null;
726 /**
727 * @description
728 * Reports the validation status of the control. Possible values include:
729 * 'VALID', 'INVALID', 'DISABLED', and 'PENDING'.
730 * If the control is not present, null is returned.
731 */
732 get status(): string | null;
733 /**
734 * @description
735 * Reports whether the control is untouched, meaning that the user has not yet triggered
736 * a `blur` event on it. If the control is not present, null is returned.
737 */
738 get untouched(): boolean | null;
739 /**
740 * @description
741 * Returns a multicasting observable that emits a validation status whenever it is
742 * calculated for the control. If the control is not present, null is returned.
743 */
744 get statusChanges(): Observable<any> | null;
745 /**
746 * @description
747 * Returns a multicasting observable of value changes for the control that emits every time the
748 * value of the control changes in the UI or programmatically.
749 * If the control is not present, null is returned.
750 */
751 get valueChanges(): Observable<any> | null;
752 /**
753 * @description
754 * Returns an array that represents the path from the top-level form to this control.
755 * Each index is the string name of the control on that level.
756 */
757 get path(): string[] | null;
758 /**
759 * Contains the result of merging synchronous validators into a single validator function
760 * (combined using `Validators.compose`).
761 */
762 private _composedValidatorFn;
763 /**
764 * Contains the result of merging asynchronous validators into a single validator function
765 * (combined using `Validators.composeAsync`).
766 */
767 private _composedAsyncValidatorFn;
768 /**
769 * @description
770 * Synchronous validator function composed of all the synchronous validators registered with this
771 * directive.
772 */
773 get validator(): ValidatorFn | null;
774 /**
775 * @description
776 * Asynchronous validator function composed of all the asynchronous validators registered with
777 * this directive.
778 */
779 get asyncValidator(): AsyncValidatorFn | null;
780 private _onDestroyCallbacks;
781 /**
782 * @description
783 * Resets the control with the provided value if the control is present.
784 */
785 reset(value?: any): void;
786 /**
787 * @description
788 * Reports whether the control with the given path has the error specified.
789 *
790 * @param errorCode The code of the error to check
791 * @param path A list of control names that designates how to move from the current control
792 * to the control that should be queried for errors.
793 *
794 * @usageNotes
795 * For example, for the following `FormGroup`:
796 *
797 * ```
798 * form = new FormGroup({
799 * address: new FormGroup({ street: new FormControl() })
800 * });
801 * ```
802 *
803 * The path to the 'street' control from the root form would be 'address' -> 'street'.
804 *
805 * It can be provided to this method in one of two formats:
806 *
807 * 1. An array of string control names, e.g. `['address', 'street']`
808 * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
809 *
810 * If no path is given, this method checks for the error on the current control.
811 *
812 * @returns whether the given error is present in the control at the given path.
813 *
814 * If the control is not present, false is returned.
815 */
816 hasError(errorCode: string, path?: Array<string | number> | string): boolean;
817 /**
818 * @description
819 * Reports error data for the control with the given path.
820 *
821 * @param errorCode The code of the error to check
822 * @param path A list of control names that designates how to move from the current control
823 * to the control that should be queried for errors.
824 *
825 * @usageNotes
826 * For example, for the following `FormGroup`:
827 *
828 * ```
829 * form = new FormGroup({
830 * address: new FormGroup({ street: new FormControl() })
831 * });
832 * ```
833 *
834 * The path to the 'street' control from the root form would be 'address' -> 'street'.
835 *
836 * It can be provided to this method in one of two formats:
837 *
838 * 1. An array of string control names, e.g. `['address', 'street']`
839 * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
840 *
841 * @returns error data for that particular error. If the control or error is not present,
842 * null is returned.
843 */
844 getError(errorCode: string, path?: Array<string | number> | string): any;
845}
846
847/**
848 * Interface for options provided to an `AbstractControl`.
849 *
850 * @publicApi
851 */
852export declare interface AbstractControlOptions {
853 /**
854 * @description
855 * The list of validators applied to a control.
856 */
857 validators?: ValidatorFn | ValidatorFn[] | null;
858 /**
859 * @description
860 * The list of async validators applied to control.
861 */
862 asyncValidators?: AsyncValidatorFn | AsyncValidatorFn[] | null;
863 /**
864 * @description
865 * The event name for control to update upon.
866 */
867 updateOn?: 'change' | 'blur' | 'submit';
868}
869
870declare class AbstractControlStatus {
871 private _cd;
872 constructor(cd: AbstractControlDirective | null);
873 protected get isTouched(): boolean;
874 protected get isUntouched(): boolean;
875 protected get isPristine(): boolean;
876 protected get isDirty(): boolean;
877 protected get isValid(): boolean;
878 protected get isInvalid(): boolean;
879 protected get isPending(): boolean;
880 protected get isSubmitted(): boolean;
881}
882
883/**
884 * @description
885 * A base class for code shared between the `NgModelGroup` and `FormGroupName` directives.
886 *
887 * @publicApi
888 */
889export declare class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy {
890 /** @nodoc */
891 ngOnInit(): void;
892 /** @nodoc */
893 ngOnDestroy(): void;
894 /**
895 * @description
896 * The `FormGroup` bound to this directive.
897 */
898 get control(): FormGroup;
899 /**
900 * @description
901 * The path to this group from the top-level directive.
902 */
903 get path(): string[];
904 /**
905 * @description
906 * The top-level directive for this group if present, otherwise null.
907 */
908 get formDirective(): Form | null;
909 static ɵfac: i0.ɵɵFactoryDeclaration<AbstractFormGroupDirective, never>;
910 static ɵdir: i0.ɵɵDirectiveDeclaration<AbstractFormGroupDirective, never, never, {}, {}, never, never, false, never>;
911}
912
913/**
914 * A base class for Validator-based Directives. The class contains common logic shared across such
915 * Directives.
916 *
917 * For internal use only, this class is not intended for use outside of the Forms package.
918 */
919declare abstract class AbstractValidatorDirective implements Validator, OnChanges {
920 private _validator;
921 private _onChange;
922 /** @nodoc */
923 ngOnChanges(changes: SimpleChanges): void;
924 /** @nodoc */
925 validate(control: AbstractControl): ValidationErrors | null;
926 /** @nodoc */
927 registerOnValidatorChange(fn: () => void): void;
928 /**
929 * @description
930 * Determines whether this validator should be active or not based on an input.
931 * Base class implementation checks whether an input is defined (if the value is different from
932 * `null` and `undefined`). Validator classes that extend this base class can override this
933 * function with the logic specific to a particular validator directive.
934 */
935 enabled(input: unknown): boolean;
936 static ɵfac: i0.ɵɵFactoryDeclaration<AbstractValidatorDirective, never>;
937 static ɵdir: i0.ɵɵDirectiveDeclaration<AbstractValidatorDirective, never, never, {}, {}, never, never, false, never>;
938}
939
940/**
941 * @description
942 * An interface implemented by classes that perform asynchronous validation.
943 *
944 * @usageNotes
945 *
946 * ### Provide a custom async validator directive
947 *
948 * The following example implements the `AsyncValidator` interface to create an
949 * async validator directive with a custom error key.
950 *
951 * ```typescript
952 * import { of } from 'rxjs';
953 *
954 * @Directive({
955 * selector: '[customAsyncValidator]',
956 * providers: [{provide: NG_ASYNC_VALIDATORS, useExisting: CustomAsyncValidatorDirective, multi:
957 * true}]
958 * })
959 * class CustomAsyncValidatorDirective implements AsyncValidator {
960 * validate(control: AbstractControl): Observable<ValidationErrors|null> {
961 * return of({'custom': true});
962 * }
963 * }
964 * ```
965 *
966 * @publicApi
967 */
968export declare interface AsyncValidator extends Validator {
969 /**
970 * @description
971 * Method that performs async validation against the provided control.
972 *
973 * @param control The control to validate against.
974 *
975 * @returns A promise or observable that resolves a map of validation errors
976 * if validation fails, otherwise null.
977 */
978 validate(control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null>;
979}
980
981/**
982 * @description
983 * A function that receives a control and returns a Promise or observable
984 * that emits validation errors if present, otherwise null.
985 *
986 * @publicApi
987 */
988export declare interface AsyncValidatorFn {
989 (control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null>;
990}
991
992/**
993 * Base class for all ControlValueAccessor classes defined in Forms package.
994 * Contains common logic and utility functions.
995 *
996 * Note: this is an *internal-only* class and should not be extended or used directly in
997 * applications code.
998 */
999declare class BaseControlValueAccessor {
1000 private _renderer;
1001 private _elementRef;
1002 /**
1003 * The registered callback function called when a change or input event occurs on the input
1004 * element.
1005 * @nodoc
1006 */
1007 onChange: (_: any) => void;
1008 /**
1009 * The registered callback function called when a blur event occurs on the input element.
1010 * @nodoc
1011 */
1012 onTouched: () => void;
1013 constructor(_renderer: Renderer2, _elementRef: ElementRef);
1014 /**
1015 * Helper method that sets a property on a target element using the current Renderer
1016 * implementation.
1017 * @nodoc
1018 */
1019 protected setProperty(key: string, value: any): void;
1020 /**
1021 * Registers a function called when the control is touched.
1022 * @nodoc
1023 */
1024 registerOnTouched(fn: () => void): void;
1025 /**
1026 * Registers a function called when the control value changes.
1027 * @nodoc
1028 */
1029 registerOnChange(fn: (_: any) => {}): void;
1030 /**
1031 * Sets the "disabled" property on the range input element.
1032 * @nodoc
1033 */
1034 setDisabledState(isDisabled: boolean): void;
1035 static ɵfac: i0.ɵɵFactoryDeclaration<BaseControlValueAccessor, never>;
1036 static ɵdir: i0.ɵɵDirectiveDeclaration<BaseControlValueAccessor, never, never, {}, {}, never, never, false, never>;
1037}
1038
1039/**
1040 * Base class for all built-in ControlValueAccessor classes (except DefaultValueAccessor, which is
1041 * used in case no other CVAs can be found). We use this class to distinguish between default CVA,
1042 * built-in CVAs and custom CVAs, so that Forms logic can recognize built-in CVAs and treat custom
1043 * ones with higher priority (when both built-in and custom CVAs are present).
1044 *
1045 * Note: this is an *internal-only* class and should not be extended or used directly in
1046 * applications code.
1047 */
1048declare class BuiltInControlValueAccessor extends BaseControlValueAccessor {
1049 static ɵfac: i0.ɵɵFactoryDeclaration<BuiltInControlValueAccessor, never>;
1050 static ɵdir: i0.ɵɵDirectiveDeclaration<BuiltInControlValueAccessor, never, never, {}, {}, never, never, false, never>;
1051}
1052
1053/**
1054 * Token to provide to allow SetDisabledState to always be called when a CVA is added, regardless of
1055 * whether the control is disabled or enabled.
1056 *
1057 * @see {@link FormsModule#withconfig}
1058 */
1059declare const CALL_SET_DISABLED_STATE: InjectionToken<SetDisabledStateOption>;
1060
1061/**
1062 * @description
1063 * Provider which adds `CheckboxRequiredValidator` to the `NG_VALIDATORS` multi-provider list.
1064 */
1065declare const CHECKBOX_REQUIRED_VALIDATOR: Provider;
1066
1067/**
1068 * @description
1069 * A `ControlValueAccessor` for writing a value and listening to changes on a checkbox input
1070 * element.
1071 *
1072 * @usageNotes
1073 *
1074 * ### Using a checkbox with a reactive form.
1075 *
1076 * The following example shows how to use a checkbox with a reactive form.
1077 *
1078 * ```ts
1079 * const rememberLoginControl = new FormControl();
1080 * ```
1081 *
1082 * ```
1083 * <input type="checkbox" [formControl]="rememberLoginControl">
1084 * ```
1085 *
1086 * @ngModule ReactiveFormsModule
1087 * @ngModule FormsModule
1088 * @publicApi
1089 */
1090export declare class CheckboxControlValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor {
1091 /**
1092 * Sets the "checked" property on the input element.
1093 * @nodoc
1094 */
1095 writeValue(value: any): void;
1096 static ɵfac: i0.ɵɵFactoryDeclaration<CheckboxControlValueAccessor, never>;
1097 static ɵdir: i0.ɵɵDirectiveDeclaration<CheckboxControlValueAccessor, "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]", never, {}, {}, never, never, false, never>;
1098}
1099
1100/**
1101 * A Directive that adds the `required` validator to checkbox controls marked with the
1102 * `required` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list.
1103 *
1104 * @see [Form Validation](guide/form-validation)
1105 *
1106 * @usageNotes
1107 *
1108 * ### Adding a required checkbox validator using template-driven forms
1109 *
1110 * The following example shows how to add a checkbox required validator to an input attached to an
1111 * ngModel binding.
1112 *
1113 * ```
1114 * <input type="checkbox" name="active" ngModel required>
1115 * ```
1116 *
1117 * @publicApi
1118 * @ngModule FormsModule
1119 * @ngModule ReactiveFormsModule
1120 */
1121export declare class CheckboxRequiredValidator extends RequiredValidator {
1122 static ɵfac: i0.ɵɵFactoryDeclaration<CheckboxRequiredValidator, never>;
1123 static ɵdir: i0.ɵɵDirectiveDeclaration<CheckboxRequiredValidator, "input[type=checkbox][required][formControlName],input[type=checkbox][required][formControl],input[type=checkbox][required][ngModel]", never, {}, {}, never, never, false, never>;
1124}
1125
1126/**
1127 * @description
1128 * Provide this token to control if form directives buffer IME input until
1129 * the "compositionend" event occurs.
1130 * @publicApi
1131 */
1132export declare const COMPOSITION_BUFFER_MODE: InjectionToken<boolean>;
1133
1134/**
1135 * ControlConfig<T> is a tuple containing a value of type T, plus optional validators and async
1136 * validators.
1137 *
1138 * @publicApi
1139 */
1140export declare type ControlConfig<T> = [T | FormControlState<T>, (ValidatorFn | (ValidatorFn[]))?, (AsyncValidatorFn | AsyncValidatorFn[])?];
1141
1142/**
1143 * @description
1144 * A base class for directives that contain multiple registered instances of `NgControl`.
1145 * Only used by the forms module.
1146 *
1147 * @publicApi
1148 */
1149export declare abstract class ControlContainer extends AbstractControlDirective {
1150 /**
1151 * @description
1152 * The name for the control
1153 */
1154 name: string | number | null;
1155 /**
1156 * @description
1157 * The top-level form directive for the control.
1158 */
1159 get formDirective(): Form | null;
1160 /**
1161 * @description
1162 * The path to this group.
1163 */
1164 get path(): string[] | null;
1165}
1166
1167/**
1168 * @description
1169 * Defines an interface that acts as a bridge between the Angular forms API and a
1170 * native element in the DOM.
1171 *
1172 * Implement this interface to create a custom form control directive
1173 * that integrates with Angular forms.
1174 *
1175 * @see {@link DefaultValueAccessor}
1176 *
1177 * @publicApi
1178 */
1179export declare interface ControlValueAccessor {
1180 /**
1181 * @description
1182 * Writes a new value to the element.
1183 *
1184 * This method is called by the forms API to write to the view when programmatic
1185 * changes from model to view are requested.
1186 *
1187 * @usageNotes
1188 * ### Write a value to the element
1189 *
1190 * The following example writes a value to the native DOM element.
1191 *
1192 * ```ts
1193 * writeValue(value: any): void {
1194 * this._renderer.setProperty(this._elementRef.nativeElement, 'value', value);
1195 * }
1196 * ```
1197 *
1198 * @param obj The new value for the element
1199 */
1200 writeValue(obj: any): void;
1201 /**
1202 * @description
1203 * Registers a callback function that is called when the control's value
1204 * changes in the UI.
1205 *
1206 * This method is called by the forms API on initialization to update the form
1207 * model when values propagate from the view to the model.
1208 *
1209 * When implementing the `registerOnChange` method in your own value accessor,
1210 * save the given function so your class calls it at the appropriate time.
1211 *
1212 * @usageNotes
1213 * ### Store the change function
1214 *
1215 * The following example stores the provided function as an internal method.
1216 *
1217 * ```ts
1218 * registerOnChange(fn: (_: any) => void): void {
1219 * this._onChange = fn;
1220 * }
1221 * ```
1222 *
1223 * When the value changes in the UI, call the registered
1224 * function to allow the forms API to update itself:
1225 *
1226 * ```ts
1227 * host: {
1228 * '(change)': '_onChange($event.target.value)'
1229 * }
1230 * ```
1231 *
1232 * @param fn The callback function to register
1233 */
1234 registerOnChange(fn: any): void;
1235 /**
1236 * @description
1237 * Registers a callback function that is called by the forms API on initialization
1238 * to update the form model on blur.
1239 *
1240 * When implementing `registerOnTouched` in your own value accessor, save the given
1241 * function so your class calls it when the control should be considered
1242 * blurred or "touched".
1243 *
1244 * @usageNotes
1245 * ### Store the callback function
1246 *
1247 * The following example stores the provided function as an internal method.
1248 *
1249 * ```ts
1250 * registerOnTouched(fn: any): void {
1251 * this._onTouched = fn;
1252 * }
1253 * ```
1254 *
1255 * On blur (or equivalent), your class should call the registered function to allow
1256 * the forms API to update itself:
1257 *
1258 * ```ts
1259 * host: {
1260 * '(blur)': '_onTouched()'
1261 * }
1262 * ```
1263 *
1264 * @param fn The callback function to register
1265 */
1266 registerOnTouched(fn: any): void;
1267 /**
1268 * @description
1269 * Function that is called by the forms API when the control status changes to
1270 * or from 'DISABLED'. Depending on the status, it enables or disables the
1271 * appropriate DOM element.
1272 *
1273 * @usageNotes
1274 * The following is an example of writing the disabled property to a native DOM element:
1275 *
1276 * ```ts
1277 * setDisabledState(isDisabled: boolean): void {
1278 * this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
1279 * }
1280 * ```
1281 *
1282 * @param isDisabled The disabled status to set on the element
1283 */
1284 setDisabledState?(isDisabled: boolean): void;
1285}
1286
1287declare const DEFAULT_VALUE_ACCESSOR: Provider;
1288
1289/**
1290 * The default `ControlValueAccessor` for writing a value and listening to changes on input
1291 * elements. The accessor is used by the `FormControlDirective`, `FormControlName`, and
1292 * `NgModel` directives.
1293 *
1294 * {@searchKeywords ngDefaultControl}
1295 *
1296 * @usageNotes
1297 *
1298 * ### Using the default value accessor
1299 *
1300 * The following example shows how to use an input element that activates the default value accessor
1301 * (in this case, a text field).
1302 *
1303 * ```ts
1304 * const firstNameControl = new FormControl();
1305 * ```
1306 *
1307 * ```
1308 * <input type="text" [formControl]="firstNameControl">
1309 * ```
1310 *
1311 * This value accessor is used by default for `<input type="text">` and `<textarea>` elements, but
1312 * you could also use it for custom components that have similar behavior and do not require special
1313 * processing. In order to attach the default value accessor to a custom element, add the
1314 * `ngDefaultControl` attribute as shown below.
1315 *
1316 * ```
1317 * <custom-input-component ngDefaultControl [(ngModel)]="value"></custom-input-component>
1318 * ```
1319 *
1320 * @ngModule ReactiveFormsModule
1321 * @ngModule FormsModule
1322 * @publicApi
1323 */
1324export declare class DefaultValueAccessor extends BaseControlValueAccessor implements ControlValueAccessor {
1325 private _compositionMode;
1326 /** Whether the user is creating a composition string (IME events). */
1327 private _composing;
1328 constructor(renderer: Renderer2, elementRef: ElementRef, _compositionMode: boolean);
1329 /**
1330 * Sets the "value" property on the input element.
1331 * @nodoc
1332 */
1333 writeValue(value: any): void;
1334 static ɵfac: i0.ɵɵFactoryDeclaration<DefaultValueAccessor, [null, null, { optional: true; }]>;
1335 static ɵdir: i0.ɵɵDirectiveDeclaration<DefaultValueAccessor, "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]", never, {}, {}, never, never, false, never>;
1336}
1337
1338/**
1339 * @description
1340 * Provider which adds `EmailValidator` to the `NG_VALIDATORS` multi-provider list.
1341 */
1342declare const EMAIL_VALIDATOR: any;
1343
1344/**
1345 * A directive that adds the `email` validator to controls marked with the
1346 * `email` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list.
1347 *
1348 * The email validation is based on the WHATWG HTML specification with some enhancements to
1349 * incorporate more RFC rules. More information can be found on the [Validators.email
1350 * page](api/forms/Validators#email).
1351 *
1352 * @see [Form Validation](guide/form-validation)
1353 *
1354 * @usageNotes
1355 *
1356 * ### Adding an email validator
1357 *
1358 * The following example shows how to add an email validator to an input attached to an ngModel
1359 * binding.
1360 *
1361 * ```
1362 * <input type="email" name="email" ngModel email>
1363 * <input type="email" name="email" ngModel email="true">
1364 * <input type="email" name="email" ngModel [email]="true">
1365 * ```
1366 *
1367 * @publicApi
1368 * @ngModule FormsModule
1369 * @ngModule ReactiveFormsModule
1370 */
1371export declare class EmailValidator extends AbstractValidatorDirective {
1372 /**
1373 * @description
1374 * Tracks changes to the email attribute bound to this directive.
1375 */
1376 email: boolean | string;
1377 /** @nodoc */
1378 enabled(input: boolean): boolean;
1379 static ɵfac: i0.ɵɵFactoryDeclaration<EmailValidator, never>;
1380 static ɵdir: i0.ɵɵDirectiveDeclaration<EmailValidator, "[email][formControlName],[email][formControl],[email][ngModel]", never, { "email": { "alias": "email"; "required": false; }; }, {}, never, never, false, never>;
1381}
1382
1383/**
1384 * @description
1385 * An interface implemented by `FormGroupDirective` and `NgForm` directives.
1386 *
1387 * Only used by the `ReactiveFormsModule` and `FormsModule`.
1388 *
1389 * @publicApi
1390 */
1391export declare interface Form {
1392 /**
1393 * @description
1394 * Add a control to this form.
1395 *
1396 * @param dir The control directive to add to the form.
1397 */
1398 addControl(dir: NgControl): void;
1399 /**
1400 * @description
1401 * Remove a control from this form.
1402 *
1403 * @param dir: The control directive to remove from the form.
1404 */
1405 removeControl(dir: NgControl): void;
1406 /**
1407 * @description
1408 * The control directive from which to get the `FormControl`.
1409 *
1410 * @param dir: The control directive.
1411 */
1412 getControl(dir: NgControl): FormControl;
1413 /**
1414 * @description
1415 * Add a group of controls to this form.
1416 *
1417 * @param dir: The control group directive to add.
1418 */
1419 addFormGroup(dir: AbstractFormGroupDirective): void;
1420 /**
1421 * @description
1422 * Remove a group of controls to this form.
1423 *
1424 * @param dir: The control group directive to remove.
1425 */
1426 removeFormGroup(dir: AbstractFormGroupDirective): void;
1427 /**
1428 * @description
1429 * The `FormGroup` associated with a particular `AbstractFormGroupDirective`.
1430 *
1431 * @param dir: The form group directive from which to get the `FormGroup`.
1432 */
1433 getFormGroup(dir: AbstractFormGroupDirective): FormGroup;
1434 /**
1435 * @description
1436 * Update the model for a particular control with a new value.
1437 *
1438 * @param dir: The control directive to update.
1439 * @param value: The new value for the control.
1440 */
1441 updateModel(dir: NgControl, value: any): void;
1442}
1443
1444/**
1445 * Tracks the value and validity state of an array of `FormControl`,
1446 * `FormGroup` or `FormArray` instances.
1447 *
1448 * A `FormArray` aggregates the values of each child `FormControl` into an array.
1449 * It calculates its status by reducing the status values of its children. For example, if one of
1450 * the controls in a `FormArray` is invalid, the entire array becomes invalid.
1451 *
1452 * `FormArray` accepts one generic argument, which is the type of the controls inside.
1453 * If you need a heterogenous array, use {@link UntypedFormArray}.
1454 *
1455 * `FormArray` is one of the four fundamental building blocks used to define forms in Angular,
1456 * along with `FormControl`, `FormGroup`, and `FormRecord`.
1457 *
1458 * @usageNotes
1459 *
1460 * ### Create an array of form controls
1461 *
1462 * ```
1463 * const arr = new FormArray([
1464 * new FormControl('Nancy', Validators.minLength(2)),
1465 * new FormControl('Drew'),
1466 * ]);
1467 *
1468 * console.log(arr.value); // ['Nancy', 'Drew']
1469 * console.log(arr.status); // 'VALID'
1470 * ```
1471 *
1472 * ### Create a form array with array-level validators
1473 *
1474 * You include array-level validators and async validators. These come in handy
1475 * when you want to perform validation that considers the value of more than one child
1476 * control.
1477 *
1478 * The two types of validators are passed in separately as the second and third arg
1479 * respectively, or together as part of an options object.
1480 *
1481 * ```
1482 * const arr = new FormArray([
1483 * new FormControl('Nancy'),
1484 * new FormControl('Drew')
1485 * ], {validators: myValidator, asyncValidators: myAsyncValidator});
1486 * ```
1487 *
1488 * ### Set the updateOn property for all controls in a form array
1489 *
1490 * The options object is used to set a default value for each child
1491 * control's `updateOn` property. If you set `updateOn` to `'blur'` at the
1492 * array level, all child controls default to 'blur', unless the child
1493 * has explicitly specified a different `updateOn` value.
1494 *
1495 * ```ts
1496 * const arr = new FormArray([
1497 * new FormControl()
1498 * ], {updateOn: 'blur'});
1499 * ```
1500 *
1501 * ### Adding or removing controls from a form array
1502 *
1503 * To change the controls in the array, use the `push`, `insert`, `removeAt` or `clear` methods
1504 * in `FormArray` itself. These methods ensure the controls are properly tracked in the
1505 * form's hierarchy. Do not modify the array of `AbstractControl`s used to instantiate
1506 * the `FormArray` directly, as that result in strange and unexpected behavior such
1507 * as broken change detection.
1508 *
1509 * @publicApi
1510 */
1511export declare class FormArray<TControl extends AbstractControl<any> = any> extends AbstractControl<ɵTypedOrUntyped<TControl, ɵFormArrayValue<TControl>, any>, ɵTypedOrUntyped<TControl, ɵFormArrayRawValue<TControl>, any>> {
1512 /**
1513 * Creates a new `FormArray` instance.
1514 *
1515 * @param controls An array of child controls. Each child control is given an index
1516 * where it is registered.
1517 *
1518 * @param validatorOrOpts A synchronous validator function, or an array of
1519 * such functions, or an `AbstractControlOptions` object that contains validation functions
1520 * and a validation trigger.
1521 *
1522 * @param asyncValidator A single async validator or array of async validator functions
1523 *
1524 */
1525 constructor(controls: Array<TControl>, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null);
1526 controls: ɵTypedOrUntyped<TControl, Array<TControl>, Array<AbstractControl<any>>>;
1527 /**
1528 * Get the `AbstractControl` at the given `index` in the array.
1529 *
1530 * @param index Index in the array to retrieve the control. If `index` is negative, it will wrap
1531 * around from the back, and if index is greatly negative (less than `-length`), the result is
1532 * undefined. This behavior is the same as `Array.at(index)`.
1533 */
1534 at(index: number): ɵTypedOrUntyped<TControl, TControl, AbstractControl<any>>;
1535 /**
1536 * Insert a new `AbstractControl` at the end of the array.
1537 *
1538 * @param control Form control to be inserted
1539 * @param options Specifies whether this FormArray instance should emit events after a new
1540 * control is added.
1541 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1542 * `valueChanges` observables emit events with the latest status and value when the control is
1543 * inserted. When false, no events are emitted.
1544 */
1545 push(control: TControl, options?: {
1546 emitEvent?: boolean;
1547 }): void;
1548 /**
1549 * Insert a new `AbstractControl` at the given `index` in the array.
1550 *
1551 * @param index Index in the array to insert the control. If `index` is negative, wraps around
1552 * from the back. If `index` is greatly negative (less than `-length`), prepends to the array.
1553 * This behavior is the same as `Array.splice(index, 0, control)`.
1554 * @param control Form control to be inserted
1555 * @param options Specifies whether this FormArray instance should emit events after a new
1556 * control is inserted.
1557 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1558 * `valueChanges` observables emit events with the latest status and value when the control is
1559 * inserted. When false, no events are emitted.
1560 */
1561 insert(index: number, control: TControl, options?: {
1562 emitEvent?: boolean;
1563 }): void;
1564 /**
1565 * Remove the control at the given `index` in the array.
1566 *
1567 * @param index Index in the array to remove the control. If `index` is negative, wraps around
1568 * from the back. If `index` is greatly negative (less than `-length`), removes the first
1569 * element. This behavior is the same as `Array.splice(index, 1)`.
1570 * @param options Specifies whether this FormArray instance should emit events after a
1571 * control is removed.
1572 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1573 * `valueChanges` observables emit events with the latest status and value when the control is
1574 * removed. When false, no events are emitted.
1575 */
1576 removeAt(index: number, options?: {
1577 emitEvent?: boolean;
1578 }): void;
1579 /**
1580 * Replace an existing control.
1581 *
1582 * @param index Index in the array to replace the control. If `index` is negative, wraps around
1583 * from the back. If `index` is greatly negative (less than `-length`), replaces the first
1584 * element. This behavior is the same as `Array.splice(index, 1, control)`.
1585 * @param control The `AbstractControl` control to replace the existing control
1586 * @param options Specifies whether this FormArray instance should emit events after an
1587 * existing control is replaced with a new one.
1588 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1589 * `valueChanges` observables emit events with the latest status and value when the control is
1590 * replaced with a new one. When false, no events are emitted.
1591 */
1592 setControl(index: number, control: TControl, options?: {
1593 emitEvent?: boolean;
1594 }): void;
1595 /**
1596 * Length of the control array.
1597 */
1598 get length(): number;
1599 /**
1600 * Sets the value of the `FormArray`. It accepts an array that matches
1601 * the structure of the control.
1602 *
1603 * This method performs strict checks, and throws an error if you try
1604 * to set the value of a control that doesn't exist or if you exclude the
1605 * value of a control.
1606 *
1607 * @usageNotes
1608 * ### Set the values for the controls in the form array
1609 *
1610 * ```
1611 * const arr = new FormArray([
1612 * new FormControl(),
1613 * new FormControl()
1614 * ]);
1615 * console.log(arr.value); // [null, null]
1616 *
1617 * arr.setValue(['Nancy', 'Drew']);
1618 * console.log(arr.value); // ['Nancy', 'Drew']
1619 * ```
1620 *
1621 * @param value Array of values for the controls
1622 * @param options Configure options that determine how the control propagates changes and
1623 * emits events after the value changes
1624 *
1625 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
1626 * is false.
1627 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1628 * `valueChanges`
1629 * observables emit events with the latest status and value when the control value is updated.
1630 * When false, no events are emitted.
1631 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
1632 * updateValueAndValidity} method.
1633 */
1634 setValue(value: ɵFormArrayRawValue<TControl>, options?: {
1635 onlySelf?: boolean;
1636 emitEvent?: boolean;
1637 }): void;
1638 /**
1639 * Patches the value of the `FormArray`. It accepts an array that matches the
1640 * structure of the control, and does its best to match the values to the correct
1641 * controls in the group.
1642 *
1643 * It accepts both super-sets and sub-sets of the array without throwing an error.
1644 *
1645 * @usageNotes
1646 * ### Patch the values for controls in a form array
1647 *
1648 * ```
1649 * const arr = new FormArray([
1650 * new FormControl(),
1651 * new FormControl()
1652 * ]);
1653 * console.log(arr.value); // [null, null]
1654 *
1655 * arr.patchValue(['Nancy']);
1656 * console.log(arr.value); // ['Nancy', null]
1657 * ```
1658 *
1659 * @param value Array of latest values for the controls
1660 * @param options Configure options that determine how the control propagates changes and
1661 * emits events after the value changes
1662 *
1663 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
1664 * is false.
1665 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1666 * `valueChanges` observables emit events with the latest status and value when the control
1667 * value is updated. When false, no events are emitted. The configuration options are passed to
1668 * the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
1669 */
1670 patchValue(value: ɵFormArrayValue<TControl>, options?: {
1671 onlySelf?: boolean;
1672 emitEvent?: boolean;
1673 }): void;
1674 /**
1675 * Resets the `FormArray` and all descendants are marked `pristine` and `untouched`, and the
1676 * value of all descendants to null or null maps.
1677 *
1678 * You reset to a specific form state by passing in an array of states
1679 * that matches the structure of the control. The state is a standalone value
1680 * or a form state object with both a value and a disabled status.
1681 *
1682 * @usageNotes
1683 * ### Reset the values in a form array
1684 *
1685 * ```ts
1686 * const arr = new FormArray([
1687 * new FormControl(),
1688 * new FormControl()
1689 * ]);
1690 * arr.reset(['name', 'last name']);
1691 *
1692 * console.log(arr.value); // ['name', 'last name']
1693 * ```
1694 *
1695 * ### Reset the values in a form array and the disabled status for the first control
1696 *
1697 * ```
1698 * arr.reset([
1699 * {value: 'name', disabled: true},
1700 * 'last'
1701 * ]);
1702 *
1703 * console.log(arr.value); // ['last']
1704 * console.log(arr.at(0).status); // 'DISABLED'
1705 * ```
1706 *
1707 * @param value Array of values for the controls
1708 * @param options Configure options that determine how the control propagates changes and
1709 * emits events after the value changes
1710 *
1711 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
1712 * is false.
1713 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1714 * `valueChanges`
1715 * observables emit events with the latest status and value when the control is reset.
1716 * When false, no events are emitted.
1717 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
1718 * updateValueAndValidity} method.
1719 */
1720 reset(value?: ɵTypedOrUntyped<TControl, ɵFormArrayValue<TControl>, any>, options?: {
1721 onlySelf?: boolean;
1722 emitEvent?: boolean;
1723 }): void;
1724 /**
1725 * The aggregate value of the array, including any disabled controls.
1726 *
1727 * Reports all values regardless of disabled status.
1728 */
1729 getRawValue(): ɵFormArrayRawValue<TControl>;
1730 /**
1731 * Remove all controls in the `FormArray`.
1732 *
1733 * @param options Specifies whether this FormArray instance should emit events after all
1734 * controls are removed.
1735 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1736 * `valueChanges` observables emit events with the latest status and value when all controls
1737 * in this FormArray instance are removed. When false, no events are emitted.
1738 *
1739 * @usageNotes
1740 * ### Remove all elements from a FormArray
1741 *
1742 * ```ts
1743 * const arr = new FormArray([
1744 * new FormControl(),
1745 * new FormControl()
1746 * ]);
1747 * console.log(arr.length); // 2
1748 *
1749 * arr.clear();
1750 * console.log(arr.length); // 0
1751 * ```
1752 *
1753 * It's a simpler and more efficient alternative to removing all elements one by one:
1754 *
1755 * ```ts
1756 * const arr = new FormArray([
1757 * new FormControl(),
1758 * new FormControl()
1759 * ]);
1760 *
1761 * while (arr.length) {
1762 * arr.removeAt(0);
1763 * }
1764 * ```
1765 */
1766 clear(options?: {
1767 emitEvent?: boolean;
1768 }): void;
1769 private _registerControl;
1770}
1771
1772/**
1773 * @description
1774 *
1775 * Syncs a nested `FormArray` to a DOM element.
1776 *
1777 * This directive is designed to be used with a parent `FormGroupDirective` (selector:
1778 * `[formGroup]`).
1779 *
1780 * It accepts the string name of the nested `FormArray` you want to link, and
1781 * will look for a `FormArray` registered with that name in the parent
1782 * `FormGroup` instance you passed into `FormGroupDirective`.
1783 *
1784 * @see [Reactive Forms Guide](guide/reactive-forms)
1785 * @see {@link AbstractControl}
1786 *
1787 * @usageNotes
1788 *
1789 * ### Example
1790 *
1791 * {@example forms/ts/nestedFormArray/nested_form_array_example.ts region='Component'}
1792 *
1793 * @ngModule ReactiveFormsModule
1794 * @publicApi
1795 */
1796export declare class FormArrayName extends ControlContainer implements OnInit, OnDestroy {
1797 /**
1798 * @description
1799 * Tracks the name of the `FormArray` bound to the directive. The name corresponds
1800 * to a key in the parent `FormGroup` or `FormArray`.
1801 * Accepts a name as a string or a number.
1802 * The name in the form of a string is useful for individual forms,
1803 * while the numerical form allows for form arrays to be bound
1804 * to indices when iterating over arrays in a `FormArray`.
1805 */
1806 name: string | number | null;
1807 constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
1808 /**
1809 * A lifecycle method called when the directive's inputs are initialized. For internal use only.
1810 * @throws If the directive does not have a valid parent.
1811 * @nodoc
1812 */
1813 ngOnInit(): void;
1814 /**
1815 * A lifecycle method called before the directive's instance is destroyed. For internal use only.
1816 * @nodoc
1817 */
1818 ngOnDestroy(): void;
1819 /**
1820 * @description
1821 * The `FormArray` bound to this directive.
1822 */
1823 get control(): FormArray;
1824 /**
1825 * @description
1826 * The top-level directive for this group if present, otherwise null.
1827 */
1828 get formDirective(): FormGroupDirective | null;
1829 /**
1830 * @description
1831 * Returns an array that represents the path from the top-level form to this control.
1832 * Each index is the string name of the control on that level.
1833 */
1834 get path(): string[];
1835 private _checkParentType;
1836 static ɵfac: i0.ɵɵFactoryDeclaration<FormArrayName, [{ optional: true; host: true; skipSelf: true; }, { optional: true; self: true; }, { optional: true; self: true; }]>;
1837 static ɵdir: i0.ɵɵDirectiveDeclaration<FormArrayName, "[formArrayName]", never, { "name": { "alias": "formArrayName"; "required": false; }; }, {}, never, never, false, never>;
1838}
1839
1840declare const formArrayNameProvider: any;
1841
1842/**
1843 * @description
1844 * Creates an `AbstractControl` from a user-specified configuration.
1845 *
1846 * The `FormBuilder` provides syntactic sugar that shortens creating instances of a
1847 * `FormControl`, `FormGroup`, or `FormArray`. It reduces the amount of boilerplate needed to
1848 * build complex forms.
1849 *
1850 * @see [Reactive Forms Guide](guide/reactive-forms)
1851 *
1852 * @publicApi
1853 */
1854export declare class FormBuilder {
1855 private useNonNullable;
1856 /**
1857 * @description
1858 * Returns a FormBuilder in which automatically constructed `FormControl` elements
1859 * have `{nonNullable: true}` and are non-nullable.
1860 *
1861 * **Constructing non-nullable controls**
1862 *
1863 * When constructing a control, it will be non-nullable, and will reset to its initial value.
1864 *
1865 * ```ts
1866 * let nnfb = new FormBuilder().nonNullable;
1867 * let name = nnfb.control('Alex'); // FormControl<string>
1868 * name.reset();
1869 * console.log(name); // 'Alex'
1870 * ```
1871 *
1872 * **Constructing non-nullable groups or arrays**
1873 *
1874 * When constructing a group or array, all automatically created inner controls will be
1875 * non-nullable, and will reset to their initial values.
1876 *
1877 * ```ts
1878 * let nnfb = new FormBuilder().nonNullable;
1879 * let name = nnfb.group({who: 'Alex'}); // FormGroup<{who: FormControl<string>}>
1880 * name.reset();
1881 * console.log(name); // {who: 'Alex'}
1882 * ```
1883 * **Constructing *nullable* fields on groups or arrays**
1884 *
1885 * It is still possible to have a nullable field. In particular, any `FormControl` which is
1886 * *already* constructed will not be altered. For example:
1887 *
1888 * ```ts
1889 * let nnfb = new FormBuilder().nonNullable;
1890 * // FormGroup<{who: FormControl<string|null>}>
1891 * let name = nnfb.group({who: new FormControl('Alex')});
1892 * name.reset(); console.log(name); // {who: null}
1893 * ```
1894 *
1895 * Because the inner control is constructed explicitly by the caller, the builder has
1896 * no control over how it is created, and cannot exclude the `null`.
1897 */
1898 get nonNullable(): NonNullableFormBuilder;
1899 /**
1900 * @description
1901 * Constructs a new `FormGroup` instance. Accepts a single generic argument, which is an object
1902 * containing all the keys and corresponding inner control types.
1903 *
1904 * @param controls A collection of child controls. The key for each child is the name
1905 * under which it is registered.
1906 *
1907 * @param options Configuration options object for the `FormGroup`. The object should have the
1908 * `AbstractControlOptions` type and might contain the following fields:
1909 * * `validators`: A synchronous validator function, or an array of validator functions.
1910 * * `asyncValidators`: A single async validator or array of async validator functions.
1911 * * `updateOn`: The event upon which the control should be updated (options: 'change' | 'blur'
1912 * | submit').
1913 */
1914 group<T extends {}>(controls: T, options?: AbstractControlOptions | null): FormGroup<{
1915 [K in keyof T]: ɵElement<T[K], null>;
1916 }>;
1917 /**
1918 * @description
1919 * Constructs a new `FormGroup` instance.
1920 *
1921 * @deprecated This API is not typesafe and can result in issues with Closure Compiler renaming.
1922 * Use the `FormBuilder#group` overload with `AbstractControlOptions` instead.
1923 * Note that `AbstractControlOptions` expects `validators` and `asyncValidators` to be valid
1924 * validators. If you have custom validators, make sure their validation function parameter is
1925 * `AbstractControl` and not a sub-class, such as `FormGroup`. These functions will be called
1926 * with an object of type `AbstractControl` and that cannot be automatically downcast to a
1927 * subclass, so TypeScript sees this as an error. For example, change the `(group: FormGroup) =>
1928 * ValidationErrors|null` signature to be `(group: AbstractControl) => ValidationErrors|null`.
1929 *
1930 * @param controls A record of child controls. The key for each child is the name
1931 * under which the control is registered.
1932 *
1933 * @param options Configuration options object for the `FormGroup`. The legacy configuration
1934 * object consists of:
1935 * * `validator`: A synchronous validator function, or an array of validator functions.
1936 * * `asyncValidator`: A single async validator or array of async validator functions
1937 * Note: the legacy format is deprecated and might be removed in one of the next major versions
1938 * of Angular.
1939 */
1940 group(controls: {
1941 [key: string]: any;
1942 }, options: {
1943 [key: string]: any;
1944 }): FormGroup;
1945 /**
1946 * @description
1947 * Constructs a new `FormRecord` instance. Accepts a single generic argument, which is an object
1948 * containing all the keys and corresponding inner control types.
1949 *
1950 * @param controls A collection of child controls. The key for each child is the name
1951 * under which it is registered.
1952 *
1953 * @param options Configuration options object for the `FormRecord`. The object should have the
1954 * `AbstractControlOptions` type and might contain the following fields:
1955 * * `validators`: A synchronous validator function, or an array of validator functions.
1956 * * `asyncValidators`: A single async validator or array of async validator functions.
1957 * * `updateOn`: The event upon which the control should be updated (options: 'change' | 'blur'
1958 * | submit').
1959 */
1960 record<T>(controls: {
1961 [key: string]: T;
1962 }, options?: AbstractControlOptions | null): FormRecord<ɵElement<T, null>>;
1963 /** @deprecated Use `nonNullable` instead. */
1964 control<T>(formState: T | FormControlState<T>, opts: FormControlOptions & {
1965 initialValueIsDefault: true;
1966 }): FormControl<T>;
1967 control<T>(formState: T | FormControlState<T>, opts: FormControlOptions & {
1968 nonNullable: true;
1969 }): FormControl<T>;
1970 /**
1971 * @deprecated When passing an `options` argument, the `asyncValidator` argument has no effect.
1972 */
1973 control<T>(formState: T | FormControlState<T>, opts: FormControlOptions, asyncValidator: AsyncValidatorFn | AsyncValidatorFn[]): FormControl<T | null>;
1974 control<T>(formState: T | FormControlState<T>, validatorOrOpts?: ValidatorFn | ValidatorFn[] | FormControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): FormControl<T | null>;
1975 /**
1976 * Constructs a new `FormArray` from the given array of configurations,
1977 * validators and options. Accepts a single generic argument, which is the type of each control
1978 * inside the array.
1979 *
1980 * @param controls An array of child controls or control configs. Each child control is given an
1981 * index when it is registered.
1982 *
1983 * @param validatorOrOpts A synchronous validator function, or an array of such functions, or an
1984 * `AbstractControlOptions` object that contains
1985 * validation functions and a validation trigger.
1986 *
1987 * @param asyncValidator A single async validator or array of async validator functions.
1988 */
1989 array<T>(controls: Array<T>, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): FormArray<ɵElement<T, null>>;
1990 static ɵfac: i0.ɵɵFactoryDeclaration<FormBuilder, never>;
1991 static ɵprov: i0.ɵɵInjectableDeclaration<FormBuilder>;
1992}
1993
1994/**
1995 * Tracks the value and validation status of an individual form control.
1996 *
1997 * This is one of the four fundamental building blocks of Angular forms, along with
1998 * `FormGroup`, `FormArray` and `FormRecord`. It extends the `AbstractControl` class that
1999 * implements most of the base functionality for accessing the value, validation status,
2000 * user interactions and events.
2001 *
2002 * `FormControl` takes a single generic argument, which describes the type of its value. This
2003 * argument always implicitly includes `null` because the control can be reset. To change this
2004 * behavior, set `nonNullable` or see the usage notes below.
2005 *
2006 * See [usage examples below](#usage-notes).
2007 *
2008 * @see {@link AbstractControl}
2009 * @see [Reactive Forms Guide](guide/reactive-forms)
2010 * @see [Usage Notes](#usage-notes)
2011 *
2012 * @publicApi
2013 *
2014 * @overriddenImplementation ɵFormControlCtor
2015 *
2016 * @usageNotes
2017 *
2018 * ### Initializing Form Controls
2019 *
2020 * Instantiate a `FormControl`, with an initial value.
2021 *
2022 * ```ts
2023 * const control = new FormControl('some value');
2024 * console.log(control.value); // 'some value'
2025 * ```
2026 *
2027 * The following example initializes the control with a form state object. The `value`
2028 * and `disabled` keys are required in this case.
2029 *
2030 * ```ts
2031 * const control = new FormControl({ value: 'n/a', disabled: true });
2032 * console.log(control.value); // 'n/a'
2033 * console.log(control.status); // 'DISABLED'
2034 * ```
2035 *
2036 * The following example initializes the control with a synchronous validator.
2037 *
2038 * ```ts
2039 * const control = new FormControl('', Validators.required);
2040 * console.log(control.value); // ''
2041 * console.log(control.status); // 'INVALID'
2042 * ```
2043 *
2044 * The following example initializes the control using an options object.
2045 *
2046 * ```ts
2047 * const control = new FormControl('', {
2048 * validators: Validators.required,
2049 * asyncValidators: myAsyncValidator
2050 * });
2051 * ```
2052 *
2053 * ### The single type argument
2054 *
2055 * `FormControl` accepts a generic argument, which describes the type of its value.
2056 * In most cases, this argument will be inferred.
2057 *
2058 * If you are initializing the control to `null`, or you otherwise wish to provide a
2059 * wider type, you may specify the argument explicitly:
2060 *
2061 * ```
2062 * let fc = new FormControl<string|null>(null);
2063 * fc.setValue('foo');
2064 * ```
2065 *
2066 * You might notice that `null` is always added to the type of the control.
2067 * This is because the control will become `null` if you call `reset`. You can change
2068 * this behavior by setting `{nonNullable: true}`.
2069 *
2070 * ### Configure the control to update on a blur event
2071 *
2072 * Set the `updateOn` option to `'blur'` to update on the blur `event`.
2073 *
2074 * ```ts
2075 * const control = new FormControl('', { updateOn: 'blur' });
2076 * ```
2077 *
2078 * ### Configure the control to update on a submit event
2079 *
2080 * Set the `updateOn` option to `'submit'` to update on a submit `event`.
2081 *
2082 * ```ts
2083 * const control = new FormControl('', { updateOn: 'submit' });
2084 * ```
2085 *
2086 * ### Reset the control back to a specific value
2087 *
2088 * You reset to a specific form state by passing through a standalone
2089 * value or a form state object that contains both a value and a disabled state
2090 * (these are the only two properties that cannot be calculated).
2091 *
2092 * ```ts
2093 * const control = new FormControl('Nancy');
2094 *
2095 * console.log(control.value); // 'Nancy'
2096 *
2097 * control.reset('Drew');
2098 *
2099 * console.log(control.value); // 'Drew'
2100 * ```
2101 *
2102 * ### Reset the control to its initial value
2103 *
2104 * If you wish to always reset the control to its initial value (instead of null),
2105 * you can pass the `nonNullable` option:
2106 *
2107 * ```
2108 * const control = new FormControl('Nancy', {nonNullable: true});
2109 *
2110 * console.log(control.value); // 'Nancy'
2111 *
2112 * control.reset();
2113 *
2114 * console.log(control.value); // 'Nancy'
2115 * ```
2116 *
2117 * ### Reset the control back to an initial value and disabled
2118 *
2119 * ```
2120 * const control = new FormControl('Nancy');
2121 *
2122 * console.log(control.value); // 'Nancy'
2123 * console.log(control.status); // 'VALID'
2124 *
2125 * control.reset({ value: 'Drew', disabled: true });
2126 *
2127 * console.log(control.value); // 'Drew'
2128 * console.log(control.status); // 'DISABLED'
2129 * ```
2130 */
2131export declare interface FormControl<TValue = any> extends AbstractControl<TValue> {
2132 /**
2133 * The default value of this FormControl, used whenever the control is reset without an explicit
2134 * value. See {@link FormControlOptions#nonNullable} for more information on configuring
2135 * a default value.
2136 */
2137 readonly defaultValue: TValue;
2138 /**
2139 * Sets a new value for the form control.
2140 *
2141 * @param value The new value for the control.
2142 * @param options Configuration options that determine how the control propagates changes
2143 * and emits events when the value changes.
2144 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
2145 * updateValueAndValidity} method.
2146 *
2147 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
2148 * false.
2149 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
2150 * `valueChanges`
2151 * observables emit events with the latest status and value when the control value is updated.
2152 * When false, no events are emitted.
2153 * * `emitModelToViewChange`: When true or not supplied (the default), each change triggers an
2154 * `onChange` event to
2155 * update the view.
2156 * * `emitViewToModelChange`: When true or not supplied (the default), each change triggers an
2157 * `ngModelChange`
2158 * event to update the model.
2159 *
2160 */
2161 setValue(value: TValue, options?: {
2162 onlySelf?: boolean;
2163 emitEvent?: boolean;
2164 emitModelToViewChange?: boolean;
2165 emitViewToModelChange?: boolean;
2166 }): void;
2167 /**
2168 * Patches the value of a control.
2169 *
2170 * This function is functionally the same as {@link FormControl#setValue setValue} at this level.
2171 * It exists for symmetry with {@link FormGroup#patchValue patchValue} on `FormGroups` and
2172 * `FormArrays`, where it does behave differently.
2173 *
2174 * @see {@link FormControl#setValue} for options
2175 */
2176 patchValue(value: TValue, options?: {
2177 onlySelf?: boolean;
2178 emitEvent?: boolean;
2179 emitModelToViewChange?: boolean;
2180 emitViewToModelChange?: boolean;
2181 }): void;
2182 /**
2183 * Resets the form control, marking it `pristine` and `untouched`, and resetting
2184 * the value. The new value will be the provided value (if passed), `null`, or the initial value
2185 * if `nonNullable` was set in the constructor via {@link FormControlOptions}.
2186 *
2187 * ```ts
2188 * // By default, the control will reset to null.
2189 * const dog = new FormControl('spot');
2190 * dog.reset(); // dog.value is null
2191 *
2192 * // If this flag is set, the control will instead reset to the initial value.
2193 * const cat = new FormControl('tabby', {nonNullable: true});
2194 * cat.reset(); // cat.value is "tabby"
2195 *
2196 * // A value passed to reset always takes precedence.
2197 * const fish = new FormControl('finn', {nonNullable: true});
2198 * fish.reset('bubble'); // fish.value is "bubble"
2199 * ```
2200 *
2201 * @param formState Resets the control with an initial value,
2202 * or an object that defines the initial value and disabled state.
2203 *
2204 * @param options Configuration options that determine how the control propagates changes
2205 * and emits events after the value changes.
2206 *
2207 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
2208 * false.
2209 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
2210 * `valueChanges`
2211 * observables emit events with the latest status and value when the control is reset.
2212 * When false, no events are emitted.
2213 *
2214 */
2215 reset(formState?: TValue | FormControlState<TValue>, options?: {
2216 onlySelf?: boolean;
2217 emitEvent?: boolean;
2218 }): void;
2219 /**
2220 * For a simple FormControl, the raw value is equivalent to the value.
2221 */
2222 getRawValue(): TValue;
2223 /**
2224 * Register a listener for change events.
2225 *
2226 * @param fn The method that is called when the value changes
2227 */
2228 registerOnChange(fn: Function): void;
2229 /**
2230 * Register a listener for disabled events.
2231 *
2232 * @param fn The method that is called when the disabled status changes.
2233 */
2234 registerOnDisabledChange(fn: (isDisabled: boolean) => void): void;
2235}
2236
2237export declare const FormControl: ɵFormControlCtor;
2238
2239/**
2240 * @description
2241 * Synchronizes a standalone `FormControl` instance to a form control element.
2242 *
2243 * Note that support for using the `ngModel` input property and `ngModelChange` event with reactive
2244 * form directives was deprecated in Angular v6 and is scheduled for removal in
2245 * a future version of Angular.
2246 * For details, see [Deprecated features](guide/deprecations#ngmodel-with-reactive-forms).
2247 *
2248 * @see [Reactive Forms Guide](guide/reactive-forms)
2249 * @see {@link FormControl}
2250 * @see {@link AbstractControl}
2251 *
2252 * @usageNotes
2253 *
2254 * The following example shows how to register a standalone control and set its value.
2255 *
2256 * {@example forms/ts/simpleFormControl/simple_form_control_example.ts region='Component'}
2257 *
2258 * @ngModule ReactiveFormsModule
2259 * @publicApi
2260 */
2261export declare class FormControlDirective extends NgControl implements OnChanges, OnDestroy {
2262 private _ngModelWarningConfig;
2263 private callSetDisabledState?;
2264 /**
2265 * Internal reference to the view model value.
2266 * @nodoc
2267 */
2268 viewModel: any;
2269 /**
2270 * @description
2271 * Tracks the `FormControl` instance bound to the directive.
2272 */
2273 form: FormControl;
2274 /**
2275 * @description
2276 * Triggers a warning in dev mode that this input should not be used with reactive forms.
2277 */
2278 set isDisabled(isDisabled: boolean);
2279 /** @deprecated as of v6 */
2280 model: any;
2281 /** @deprecated as of v6 */
2282 update: EventEmitter<any>;
2283 constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[], _ngModelWarningConfig: string | null, callSetDisabledState?: SetDisabledStateOption | undefined);
2284 /** @nodoc */
2285 ngOnChanges(changes: SimpleChanges): void;
2286 /** @nodoc */
2287 ngOnDestroy(): void;
2288 /**
2289 * @description
2290 * Returns an array that represents the path from the top-level form to this control.
2291 * Each index is the string name of the control on that level.
2292 */
2293 get path(): string[];
2294 /**
2295 * @description
2296 * The `FormControl` bound to this directive.
2297 */
2298 get control(): FormControl;
2299 /**
2300 * @description
2301 * Sets the new value for the view model and emits an `ngModelChange` event.
2302 *
2303 * @param newValue The new value for the view model.
2304 */
2305 viewToModelUpdate(newValue: any): void;
2306 private _isControlChanged;
2307 static ɵfac: i0.ɵɵFactoryDeclaration<FormControlDirective, [{ optional: true; self: true; }, { optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }, { optional: true; }]>;
2308 static ɵdir: i0.ɵɵDirectiveDeclaration<FormControlDirective, "[formControl]", ["ngForm"], { "form": { "alias": "formControl"; "required": false; }; "isDisabled": { "alias": "disabled"; "required": false; }; "model": { "alias": "ngModel"; "required": false; }; }, { "update": "ngModelChange"; }, never, never, false, never>;
2309}
2310
2311/**
2312 * @description
2313 * Syncs a `FormControl` in an existing `FormGroup` to a form control
2314 * element by name.
2315 *
2316 * @see [Reactive Forms Guide](guide/reactive-forms)
2317 * @see {@link FormControl}
2318 * @see {@link AbstractControl}
2319 *
2320 * @usageNotes
2321 *
2322 * ### Register `FormControl` within a group
2323 *
2324 * The following example shows how to register multiple form controls within a form group
2325 * and set their value.
2326 *
2327 * {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
2328 *
2329 * To see `formControlName` examples with different form control types, see:
2330 *
2331 * * Radio buttons: `RadioControlValueAccessor`
2332 * * Selects: `SelectControlValueAccessor`
2333 *
2334 * ### Use with ngModel is deprecated
2335 *
2336 * Support for using the `ngModel` input property and `ngModelChange` event with reactive
2337 * form directives has been deprecated in Angular v6 and is scheduled for removal in
2338 * a future version of Angular.
2339 *
2340 * For details, see [Deprecated features](guide/deprecations#ngmodel-with-reactive-forms).
2341 *
2342 * @ngModule ReactiveFormsModule
2343 * @publicApi
2344 */
2345export declare class FormControlName extends NgControl implements OnChanges, OnDestroy {
2346 private _ngModelWarningConfig;
2347 private _added;
2348 /**
2349 * @description
2350 * Tracks the `FormControl` instance bound to the directive.
2351 */
2352 readonly control: FormControl;
2353 /**
2354 * @description
2355 * Tracks the name of the `FormControl` bound to the directive. The name corresponds
2356 * to a key in the parent `FormGroup` or `FormArray`.
2357 * Accepts a name as a string or a number.
2358 * The name in the form of a string is useful for individual forms,
2359 * while the numerical form allows for form controls to be bound
2360 * to indices when iterating over controls in a `FormArray`.
2361 */
2362 name: string | number | null;
2363 /**
2364 * @description
2365 * Triggers a warning in dev mode that this input should not be used with reactive forms.
2366 */
2367 set isDisabled(isDisabled: boolean);
2368 /** @deprecated as of v6 */
2369 model: any;
2370 /** @deprecated as of v6 */
2371 update: EventEmitter<any>;
2372 constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[], _ngModelWarningConfig: string | null);
2373 /** @nodoc */
2374 ngOnChanges(changes: SimpleChanges): void;
2375 /** @nodoc */
2376 ngOnDestroy(): void;
2377 /**
2378 * @description
2379 * Sets the new value for the view model and emits an `ngModelChange` event.
2380 *
2381 * @param newValue The new value for the view model.
2382 */
2383 viewToModelUpdate(newValue: any): void;
2384 /**
2385 * @description
2386 * Returns an array that represents the path from the top-level form to this control.
2387 * Each index is the string name of the control on that level.
2388 */
2389 get path(): string[];
2390 /**
2391 * @description
2392 * The top-level directive for this group if present, otherwise null.
2393 */
2394 get formDirective(): any;
2395 private _checkParentType;
2396 private _setUpControl;
2397 static ɵfac: i0.ɵɵFactoryDeclaration<FormControlName, [{ optional: true; host: true; skipSelf: true; }, { optional: true; self: true; }, { optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }]>;
2398 static ɵdir: i0.ɵɵDirectiveDeclaration<FormControlName, "[formControlName]", never, { "name": { "alias": "formControlName"; "required": false; }; "isDisabled": { "alias": "disabled"; "required": false; }; "model": { "alias": "ngModel"; "required": false; }; }, { "update": "ngModelChange"; }, never, never, false, never>;
2399}
2400
2401/**
2402 * Interface for options provided to a `FormControl`.
2403 *
2404 * This interface extends all options from {@link AbstractControlOptions}, plus some options
2405 * unique to `FormControl`.
2406 *
2407 * @publicApi
2408 */
2409export declare interface FormControlOptions extends AbstractControlOptions {
2410 /**
2411 * @description
2412 * Whether to use the initial value used to construct the `FormControl` as its default value
2413 * as well. If this option is false or not provided, the default value of a FormControl is `null`.
2414 * When a FormControl is reset without an explicit value, its value reverts to
2415 * its default value.
2416 */
2417 nonNullable?: boolean;
2418 /**
2419 * @deprecated Use `nonNullable` instead.
2420 */
2421 initialValueIsDefault?: boolean;
2422}
2423
2424/**
2425 * FormControlState is a boxed form value. It is an object with a `value` key and a `disabled` key.
2426 *
2427 * @publicApi
2428 */
2429export declare interface FormControlState<T> {
2430 value: T;
2431 disabled: boolean;
2432}
2433
2434/**
2435 * A form can have several different statuses. Each
2436 * possible status is returned as a string literal.
2437 *
2438 * * **VALID**: Reports that a control is valid, meaning that no errors exist in the input
2439 * value.
2440 * * **INVALID**: Reports that a control is invalid, meaning that an error exists in the input
2441 * value.
2442 * * **PENDING**: Reports that a control is pending, meaning that async validation is
2443 * occurring and errors are not yet available for the input value.
2444 * * **DISABLED**: Reports that a control is
2445 * disabled, meaning that the control is exempt from ancestor calculations of validity or value.
2446 *
2447 * @publicApi
2448 */
2449export declare type FormControlStatus = 'VALID' | 'INVALID' | 'PENDING' | 'DISABLED';
2450
2451/**
2452 * Tracks the value and validity state of a group of `FormControl` instances.
2453 *
2454 * A `FormGroup` aggregates the values of each child `FormControl` into one object,
2455 * with each control name as the key. It calculates its status by reducing the status values
2456 * of its children. For example, if one of the controls in a group is invalid, the entire
2457 * group becomes invalid.
2458 *
2459 * `FormGroup` is one of the four fundamental building blocks used to define forms in Angular,
2460 * along with `FormControl`, `FormArray`, and `FormRecord`.
2461 *
2462 * When instantiating a `FormGroup`, pass in a collection of child controls as the first
2463 * argument. The key for each child registers the name for the control.
2464 *
2465 * `FormGroup` is intended for use cases where the keys are known ahead of time.
2466 * If you need to dynamically add and remove controls, use {@link FormRecord} instead.
2467 *
2468 * `FormGroup` accepts an optional type parameter `TControl`, which is an object type with inner
2469 * control types as values.
2470 *
2471 * @usageNotes
2472 *
2473 * ### Create a form group with 2 controls
2474 *
2475 * ```
2476 * const form = new FormGroup({
2477 * first: new FormControl('Nancy', Validators.minLength(2)),
2478 * last: new FormControl('Drew'),
2479 * });
2480 *
2481 * console.log(form.value); // {first: 'Nancy', last; 'Drew'}
2482 * console.log(form.status); // 'VALID'
2483 * ```
2484 *
2485 * ### The type argument, and optional controls
2486 *
2487 * `FormGroup` accepts one generic argument, which is an object containing its inner controls.
2488 * This type will usually be inferred automatically, but you can always specify it explicitly if you
2489 * wish.
2490 *
2491 * If you have controls that are optional (i.e. they can be removed, you can use the `?` in the
2492 * type):
2493 *
2494 * ```
2495 * const form = new FormGroup<{
2496 * first: FormControl<string|null>,
2497 * middle?: FormControl<string|null>, // Middle name is optional.
2498 * last: FormControl<string|null>,
2499 * }>({
2500 * first: new FormControl('Nancy'),
2501 * last: new FormControl('Drew'),
2502 * });
2503 * ```
2504 *
2505 * ### Create a form group with a group-level validator
2506 *
2507 * You include group-level validators as the second arg, or group-level async
2508 * validators as the third arg. These come in handy when you want to perform validation
2509 * that considers the value of more than one child control.
2510 *
2511 * ```
2512 * const form = new FormGroup({
2513 * password: new FormControl('', Validators.minLength(2)),
2514 * passwordConfirm: new FormControl('', Validators.minLength(2)),
2515 * }, passwordMatchValidator);
2516 *
2517 *
2518 * function passwordMatchValidator(g: FormGroup) {
2519 * return g.get('password').value === g.get('passwordConfirm').value
2520 * ? null : {'mismatch': true};
2521 * }
2522 * ```
2523 *
2524 * Like `FormControl` instances, you choose to pass in
2525 * validators and async validators as part of an options object.
2526 *
2527 * ```
2528 * const form = new FormGroup({
2529 * password: new FormControl('')
2530 * passwordConfirm: new FormControl('')
2531 * }, { validators: passwordMatchValidator, asyncValidators: otherValidator });
2532 * ```
2533 *
2534 * ### Set the updateOn property for all controls in a form group
2535 *
2536 * The options object is used to set a default value for each child
2537 * control's `updateOn` property. If you set `updateOn` to `'blur'` at the
2538 * group level, all child controls default to 'blur', unless the child
2539 * has explicitly specified a different `updateOn` value.
2540 *
2541 * ```ts
2542 * const c = new FormGroup({
2543 * one: new FormControl()
2544 * }, { updateOn: 'blur' });
2545 * ```
2546 *
2547 * ### Using a FormGroup with optional controls
2548 *
2549 * It is possible to have optional controls in a FormGroup. An optional control can be removed later
2550 * using `removeControl`, and can be omitted when calling `reset`. Optional controls must be
2551 * declared optional in the group's type.
2552 *
2553 * ```ts
2554 * const c = new FormGroup<{one?: FormControl<string>}>({
2555 * one: new FormControl('')
2556 * });
2557 * ```
2558 *
2559 * Notice that `c.value.one` has type `string|null|undefined`. This is because calling `c.reset({})`
2560 * without providing the optional key `one` will cause it to become `null`.
2561 *
2562 * @publicApi
2563 */
2564export declare class FormGroup<TControl extends {
2565 [K in keyof TControl]: AbstractControl<any>;
2566} = any> extends AbstractControl<ɵTypedOrUntyped<TControl, ɵFormGroupValue<TControl>, any>, ɵTypedOrUntyped<TControl, ɵFormGroupRawValue<TControl>, any>> {
2567 /**
2568 * Creates a new `FormGroup` instance.
2569 *
2570 * @param controls A collection of child controls. The key for each child is the name
2571 * under which it is registered.
2572 *
2573 * @param validatorOrOpts A synchronous validator function, or an array of
2574 * such functions, or an `AbstractControlOptions` object that contains validation functions
2575 * and a validation trigger.
2576 *
2577 * @param asyncValidator A single async validator or array of async validator functions
2578 *
2579 */
2580 constructor(controls: TControl, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null);
2581 controls: ɵTypedOrUntyped<TControl, TControl, {
2582 [key: string]: AbstractControl<any>;
2583 }>;
2584 /**
2585 * Registers a control with the group's list of controls. In a strongly-typed group, the control
2586 * must be in the group's type (possibly as an optional key).
2587 *
2588 * This method does not update the value or validity of the control.
2589 * Use {@link FormGroup#addControl addControl} instead.
2590 *
2591 * @param name The control name to register in the collection
2592 * @param control Provides the control for the given name
2593 */
2594 registerControl<K extends string & keyof TControl>(name: K, control: TControl[K]): TControl[K];
2595 registerControl(this: FormGroup<{
2596 [key: string]: AbstractControl<any>;
2597 }>, name: string, control: AbstractControl<any>): AbstractControl<any>;
2598 /**
2599 * Add a control to this group. In a strongly-typed group, the control must be in the group's type
2600 * (possibly as an optional key).
2601 *
2602 * If a control with a given name already exists, it would *not* be replaced with a new one.
2603 * If you want to replace an existing control, use the {@link FormGroup#setControl setControl}
2604 * method instead. This method also updates the value and validity of the control.
2605 *
2606 * @param name The control name to add to the collection
2607 * @param control Provides the control for the given name
2608 * @param options Specifies whether this FormGroup instance should emit events after a new
2609 * control is added.
2610 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
2611 * `valueChanges` observables emit events with the latest status and value when the control is
2612 * added. When false, no events are emitted.
2613 */
2614 addControl(this: FormGroup<{
2615 [key: string]: AbstractControl<any>;
2616 }>, name: string, control: AbstractControl, options?: {
2617 emitEvent?: boolean;
2618 }): void;
2619 addControl<K extends string & keyof TControl>(name: K, control: Required<TControl>[K], options?: {
2620 emitEvent?: boolean;
2621 }): void;
2622 removeControl(this: FormGroup<{
2623 [key: string]: AbstractControl<any>;
2624 }>, name: string, options?: {
2625 emitEvent?: boolean;
2626 }): void;
2627 removeControl<S extends string>(name: ɵOptionalKeys<TControl> & S, options?: {
2628 emitEvent?: boolean;
2629 }): void;
2630 /**
2631 * Replace an existing control. In a strongly-typed group, the control must be in the group's type
2632 * (possibly as an optional key).
2633 *
2634 * If a control with a given name does not exist in this `FormGroup`, it will be added.
2635 *
2636 * @param name The control name to replace in the collection
2637 * @param control Provides the control for the given name
2638 * @param options Specifies whether this FormGroup instance should emit events after an
2639 * existing control is replaced.
2640 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
2641 * `valueChanges` observables emit events with the latest status and value when the control is
2642 * replaced with a new one. When false, no events are emitted.
2643 */
2644 setControl<K extends string & keyof TControl>(name: K, control: TControl[K], options?: {
2645 emitEvent?: boolean;
2646 }): void;
2647 setControl(this: FormGroup<{
2648 [key: string]: AbstractControl<any>;
2649 }>, name: string, control: AbstractControl, options?: {
2650 emitEvent?: boolean;
2651 }): void;
2652 /**
2653 * Check whether there is an enabled control with the given name in the group.
2654 *
2655 * Reports false for disabled controls. If you'd like to check for existence in the group
2656 * only, use {@link AbstractControl#get get} instead.
2657 *
2658 * @param controlName The control name to check for existence in the collection
2659 *
2660 * @returns false for disabled controls, true otherwise.
2661 */
2662 contains<K extends string>(controlName: K): boolean;
2663 contains(this: FormGroup<{
2664 [key: string]: AbstractControl<any>;
2665 }>, controlName: string): boolean;
2666 /**
2667 * Sets the value of the `FormGroup`. It accepts an object that matches
2668 * the structure of the group, with control names as keys.
2669 *
2670 * @usageNotes
2671 * ### Set the complete value for the form group
2672 *
2673 * ```
2674 * const form = new FormGroup({
2675 * first: new FormControl(),
2676 * last: new FormControl()
2677 * });
2678 *
2679 * console.log(form.value); // {first: null, last: null}
2680 *
2681 * form.setValue({first: 'Nancy', last: 'Drew'});
2682 * console.log(form.value); // {first: 'Nancy', last: 'Drew'}
2683 * ```
2684 *
2685 * @throws When strict checks fail, such as setting the value of a control
2686 * that doesn't exist or if you exclude a value of a control that does exist.
2687 *
2688 * @param value The new value for the control that matches the structure of the group.
2689 * @param options Configuration options that determine how the control propagates changes
2690 * and emits events after the value changes.
2691 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
2692 * updateValueAndValidity} method.
2693 *
2694 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
2695 * false.
2696 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
2697 * `valueChanges`
2698 * observables emit events with the latest status and value when the control value is updated.
2699 * When false, no events are emitted.
2700 */
2701 setValue(value: ɵFormGroupRawValue<TControl>, options?: {
2702 onlySelf?: boolean;
2703 emitEvent?: boolean;
2704 }): void;
2705 /**
2706 * Patches the value of the `FormGroup`. It accepts an object with control
2707 * names as keys, and does its best to match the values to the correct controls
2708 * in the group.
2709 *
2710 * It accepts both super-sets and sub-sets of the group without throwing an error.
2711 *
2712 * @usageNotes
2713 * ### Patch the value for a form group
2714 *
2715 * ```
2716 * const form = new FormGroup({
2717 * first: new FormControl(),
2718 * last: new FormControl()
2719 * });
2720 * console.log(form.value); // {first: null, last: null}
2721 *
2722 * form.patchValue({first: 'Nancy'});
2723 * console.log(form.value); // {first: 'Nancy', last: null}
2724 * ```
2725 *
2726 * @param value The object that matches the structure of the group.
2727 * @param options Configuration options that determine how the control propagates changes and
2728 * emits events after the value is patched.
2729 * * `onlySelf`: When true, each change only affects this control and not its parent. Default is
2730 * true.
2731 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
2732 * `valueChanges` observables emit events with the latest status and value when the control value
2733 * is updated. When false, no events are emitted. The configuration options are passed to
2734 * the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
2735 */
2736 patchValue(value: ɵFormGroupValue<TControl>, options?: {
2737 onlySelf?: boolean;
2738 emitEvent?: boolean;
2739 }): void;
2740 /**
2741 * Resets the `FormGroup`, marks all descendants `pristine` and `untouched` and sets
2742 * the value of all descendants to their default values, or null if no defaults were provided.
2743 *
2744 * You reset to a specific form state by passing in a map of states
2745 * that matches the structure of your form, with control names as keys. The state
2746 * is a standalone value or a form state object with both a value and a disabled
2747 * status.
2748 *
2749 * @param value Resets the control with an initial value,
2750 * or an object that defines the initial value and disabled state.
2751 *
2752 * @param options Configuration options that determine how the control propagates changes
2753 * and emits events when the group is reset.
2754 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
2755 * false.
2756 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
2757 * `valueChanges`
2758 * observables emit events with the latest status and value when the control is reset.
2759 * When false, no events are emitted.
2760 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
2761 * updateValueAndValidity} method.
2762 *
2763 * @usageNotes
2764 *
2765 * ### Reset the form group values
2766 *
2767 * ```ts
2768 * const form = new FormGroup({
2769 * first: new FormControl('first name'),
2770 * last: new FormControl('last name')
2771 * });
2772 *
2773 * console.log(form.value); // {first: 'first name', last: 'last name'}
2774 *
2775 * form.reset({ first: 'name', last: 'last name' });
2776 *
2777 * console.log(form.value); // {first: 'name', last: 'last name'}
2778 * ```
2779 *
2780 * ### Reset the form group values and disabled status
2781 *
2782 * ```
2783 * const form = new FormGroup({
2784 * first: new FormControl('first name'),
2785 * last: new FormControl('last name')
2786 * });
2787 *
2788 * form.reset({
2789 * first: {value: 'name', disabled: true},
2790 * last: 'last'
2791 * });
2792 *
2793 * console.log(form.value); // {last: 'last'}
2794 * console.log(form.get('first').status); // 'DISABLED'
2795 * ```
2796 */
2797 reset(value?: ɵTypedOrUntyped<TControl, ɵFormGroupValue<TControl>, any>, options?: {
2798 onlySelf?: boolean;
2799 emitEvent?: boolean;
2800 }): void;
2801 /**
2802 * The aggregate value of the `FormGroup`, including any disabled controls.
2803 *
2804 * Retrieves all values regardless of disabled status.
2805 */
2806 getRawValue(): ɵTypedOrUntyped<TControl, ɵFormGroupRawValue<TControl>, any>;
2807}
2808
2809/**
2810 * @description
2811 *
2812 * Binds an existing `FormGroup` or `FormRecord` to a DOM element.
2813 *
2814 * This directive accepts an existing `FormGroup` instance. It will then use this
2815 * `FormGroup` instance to match any child `FormControl`, `FormGroup`/`FormRecord`,
2816 * and `FormArray` instances to child `FormControlName`, `FormGroupName`,
2817 * and `FormArrayName` directives.
2818 *
2819 * @see [Reactive Forms Guide](guide/reactive-forms)
2820 * @see {@link AbstractControl}
2821 *
2822 * @usageNotes
2823 * ### Register Form Group
2824 *
2825 * The following example registers a `FormGroup` with first name and last name controls,
2826 * and listens for the *ngSubmit* event when the button is clicked.
2827 *
2828 * {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
2829 *
2830 * @ngModule ReactiveFormsModule
2831 * @publicApi
2832 */
2833export declare class FormGroupDirective extends ControlContainer implements Form, OnChanges, OnDestroy {
2834 private callSetDisabledState?;
2835 /**
2836 * @description
2837 * Reports whether the form submission has been triggered.
2838 */
2839 readonly submitted: boolean;
2840 /**
2841 * Reference to an old form group input value, which is needed to cleanup old instance in case it
2842 * was replaced with a new one.
2843 */
2844 private _oldForm;
2845 /**
2846 * Callback that should be invoked when controls in FormGroup or FormArray collection change
2847 * (added or removed). This callback triggers corresponding DOM updates.
2848 */
2849 private readonly _onCollectionChange;
2850 /**
2851 * @description
2852 * Tracks the list of added `FormControlName` instances
2853 */
2854 directives: FormControlName[];
2855 /**
2856 * @description
2857 * Tracks the `FormGroup` bound to this directive.
2858 */
2859 form: FormGroup;
2860 /**
2861 * @description
2862 * Emits an event when the form submission has been triggered.
2863 */
2864 ngSubmit: EventEmitter<any>;
2865 constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], callSetDisabledState?: SetDisabledStateOption | undefined);
2866 /** @nodoc */
2867 ngOnChanges(changes: SimpleChanges): void;
2868 /** @nodoc */
2869 ngOnDestroy(): void;
2870 /**
2871 * @description
2872 * Returns this directive's instance.
2873 */
2874 get formDirective(): Form;
2875 /**
2876 * @description
2877 * Returns the `FormGroup` bound to this directive.
2878 */
2879 get control(): FormGroup;
2880 /**
2881 * @description
2882 * Returns an array representing the path to this group. Because this directive
2883 * always lives at the top level of a form, it always an empty array.
2884 */
2885 get path(): string[];
2886 /**
2887 * @description
2888 * Method that sets up the control directive in this group, re-calculates its value
2889 * and validity, and adds the instance to the internal list of directives.
2890 *
2891 * @param dir The `FormControlName` directive instance.
2892 */
2893 addControl(dir: FormControlName): FormControl;
2894 /**
2895 * @description
2896 * Retrieves the `FormControl` instance from the provided `FormControlName` directive
2897 *
2898 * @param dir The `FormControlName` directive instance.
2899 */
2900 getControl(dir: FormControlName): FormControl;
2901 /**
2902 * @description
2903 * Removes the `FormControlName` instance from the internal list of directives
2904 *
2905 * @param dir The `FormControlName` directive instance.
2906 */
2907 removeControl(dir: FormControlName): void;
2908 /**
2909 * Adds a new `FormGroupName` directive instance to the form.
2910 *
2911 * @param dir The `FormGroupName` directive instance.
2912 */
2913 addFormGroup(dir: FormGroupName): void;
2914 /**
2915 * Performs the necessary cleanup when a `FormGroupName` directive instance is removed from the
2916 * view.
2917 *
2918 * @param dir The `FormGroupName` directive instance.
2919 */
2920 removeFormGroup(dir: FormGroupName): void;
2921 /**
2922 * @description
2923 * Retrieves the `FormGroup` for a provided `FormGroupName` directive instance
2924 *
2925 * @param dir The `FormGroupName` directive instance.
2926 */
2927 getFormGroup(dir: FormGroupName): FormGroup;
2928 /**
2929 * Performs the necessary setup when a `FormArrayName` directive instance is added to the view.
2930 *
2931 * @param dir The `FormArrayName` directive instance.
2932 */
2933 addFormArray(dir: FormArrayName): void;
2934 /**
2935 * Performs the necessary cleanup when a `FormArrayName` directive instance is removed from the
2936 * view.
2937 *
2938 * @param dir The `FormArrayName` directive instance.
2939 */
2940 removeFormArray(dir: FormArrayName): void;
2941 /**
2942 * @description
2943 * Retrieves the `FormArray` for a provided `FormArrayName` directive instance.
2944 *
2945 * @param dir The `FormArrayName` directive instance.
2946 */
2947 getFormArray(dir: FormArrayName): FormArray;
2948 /**
2949 * Sets the new value for the provided `FormControlName` directive.
2950 *
2951 * @param dir The `FormControlName` directive instance.
2952 * @param value The new value for the directive's control.
2953 */
2954 updateModel(dir: FormControlName, value: any): void;
2955 /**
2956 * @description
2957 * Method called with the "submit" event is triggered on the form.
2958 * Triggers the `ngSubmit` emitter to emit the "submit" event as its payload.
2959 *
2960 * @param $event The "submit" event object
2961 */
2962 onSubmit($event: Event): boolean;
2963 /**
2964 * @description
2965 * Method called when the "reset" event is triggered on the form.
2966 */
2967 onReset(): void;
2968 /**
2969 * @description
2970 * Resets the form to an initial value and resets its submitted status.
2971 *
2972 * @param value The new value for the form.
2973 */
2974 resetForm(value?: any): void;
2975 private _setUpFormContainer;
2976 private _cleanUpFormContainer;
2977 private _updateRegistrations;
2978 private _updateValidators;
2979 private _checkFormPresent;
2980 static ɵfac: i0.ɵɵFactoryDeclaration<FormGroupDirective, [{ optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }]>;
2981 static ɵdir: i0.ɵɵDirectiveDeclaration<FormGroupDirective, "[formGroup]", ["ngForm"], { "form": { "alias": "formGroup"; "required": false; }; }, { "ngSubmit": "ngSubmit"; }, never, never, false, never>;
2982}
2983
2984/**
2985 * @description
2986 *
2987 * Syncs a nested `FormGroup` or `FormRecord` to a DOM element.
2988 *
2989 * This directive can only be used with a parent `FormGroupDirective`.
2990 *
2991 * It accepts the string name of the nested `FormGroup` or `FormRecord` to link, and
2992 * looks for a `FormGroup` or `FormRecord` registered with that name in the parent
2993 * `FormGroup` instance you passed into `FormGroupDirective`.
2994 *
2995 * Use nested form groups to validate a sub-group of a
2996 * form separately from the rest or to group the values of certain
2997 * controls into their own nested object.
2998 *
2999 * @see [Reactive Forms Guide](guide/reactive-forms)
3000 *
3001 * @usageNotes
3002 *
3003 * ### Access the group by name
3004 *
3005 * The following example uses the `AbstractControl.get` method to access the
3006 * associated `FormGroup`
3007 *
3008 * ```ts
3009 * this.form.get('name');
3010 * ```
3011 *
3012 * ### Access individual controls in the group
3013 *
3014 * The following example uses the `AbstractControl.get` method to access
3015 * individual controls within the group using dot syntax.
3016 *
3017 * ```ts
3018 * this.form.get('name.first');
3019 * ```
3020 *
3021 * ### Register a nested `FormGroup`.
3022 *
3023 * The following example registers a nested *name* `FormGroup` within an existing `FormGroup`,
3024 * and provides methods to retrieve the nested `FormGroup` and individual controls.
3025 *
3026 * {@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'}
3027 *
3028 * @ngModule ReactiveFormsModule
3029 * @publicApi
3030 */
3031export declare class FormGroupName extends AbstractFormGroupDirective implements OnInit, OnDestroy {
3032 /**
3033 * @description
3034 * Tracks the name of the `FormGroup` bound to the directive. The name corresponds
3035 * to a key in the parent `FormGroup` or `FormArray`.
3036 * Accepts a name as a string or a number.
3037 * The name in the form of a string is useful for individual forms,
3038 * while the numerical form allows for form groups to be bound
3039 * to indices when iterating over groups in a `FormArray`.
3040 */
3041 name: string | number | null;
3042 constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
3043 static ɵfac: i0.ɵɵFactoryDeclaration<FormGroupName, [{ optional: true; host: true; skipSelf: true; }, { optional: true; self: true; }, { optional: true; self: true; }]>;
3044 static ɵdir: i0.ɵɵDirectiveDeclaration<FormGroupName, "[formGroupName]", never, { "name": { "alias": "formGroupName"; "required": false; }; }, {}, never, never, false, never>;
3045}
3046
3047declare type FormHooks = 'change' | 'blur' | 'submit';
3048
3049/**
3050 * Tracks the value and validity state of a collection of `FormControl` instances, each of which has
3051 * the same value type.
3052 *
3053 * `FormRecord` is very similar to {@link FormGroup}, except it can be used with a dynamic keys,
3054 * with controls added and removed as needed.
3055 *
3056 * `FormRecord` accepts one generic argument, which describes the type of the controls it contains.
3057 *
3058 * @usageNotes
3059 *
3060 * ```
3061 * let numbers = new FormRecord({bill: new FormControl('415-123-456')});
3062 * numbers.addControl('bob', new FormControl('415-234-567'));
3063 * numbers.removeControl('bill');
3064 * ```
3065 *
3066 * @publicApi
3067 */
3068export declare class FormRecord<TControl extends AbstractControl = AbstractControl> extends FormGroup<{
3069 [key: string]: TControl;
3070}> {
3071}
3072
3073export declare interface FormRecord<TControl> {
3074 /**
3075 * Registers a control with the records's list of controls.
3076 *
3077 * See `FormGroup#registerControl` for additional information.
3078 */
3079 registerControl(name: string, control: TControl): TControl;
3080 /**
3081 * Add a control to this group.
3082 *
3083 * See `FormGroup#addControl` for additional information.
3084 */
3085 addControl(name: string, control: TControl, options?: {
3086 emitEvent?: boolean;
3087 }): void;
3088 /**
3089 * Remove a control from this group.
3090 *
3091 * See `FormGroup#removeControl` for additional information.
3092 */
3093 removeControl(name: string, options?: {
3094 emitEvent?: boolean;
3095 }): void;
3096 /**
3097 * Replace an existing control.
3098 *
3099 * See `FormGroup#setControl` for additional information.
3100 */
3101 setControl(name: string, control: TControl, options?: {
3102 emitEvent?: boolean;
3103 }): void;
3104 /**
3105 * Check whether there is an enabled control with the given name in the group.
3106 *
3107 * See `FormGroup#contains` for additional information.
3108 */
3109 contains(controlName: string): boolean;
3110 /**
3111 * Sets the value of the `FormRecord`. It accepts an object that matches
3112 * the structure of the group, with control names as keys.
3113 *
3114 * See `FormGroup#setValue` for additional information.
3115 */
3116 setValue(value: {
3117 [key: string]: ɵValue<TControl>;
3118 }, options?: {
3119 onlySelf?: boolean;
3120 emitEvent?: boolean;
3121 }): void;
3122 /**
3123 * Patches the value of the `FormRecord`. It accepts an object with control
3124 * names as keys, and does its best to match the values to the correct controls
3125 * in the group.
3126 *
3127 * See `FormGroup#patchValue` for additional information.
3128 */
3129 patchValue(value: {
3130 [key: string]: ɵValue<TControl>;
3131 }, options?: {
3132 onlySelf?: boolean;
3133 emitEvent?: boolean;
3134 }): void;
3135 /**
3136 * Resets the `FormRecord`, marks all descendants `pristine` and `untouched` and sets
3137 * the value of all descendants to null.
3138 *
3139 * See `FormGroup#reset` for additional information.
3140 */
3141 reset(value?: {
3142 [key: string]: ɵValue<TControl>;
3143 }, options?: {
3144 onlySelf?: boolean;
3145 emitEvent?: boolean;
3146 }): void;
3147 /**
3148 * The aggregate value of the `FormRecord`, including any disabled controls.
3149 *
3150 * See `FormGroup#getRawValue` for additional information.
3151 */
3152 getRawValue(): {
3153 [key: string]: ɵRawValue<TControl>;
3154 };
3155}
3156
3157/**
3158 * Exports the required providers and directives for template-driven forms,
3159 * making them available for import by NgModules that import this module.
3160 *
3161 * @see [Forms Overview](/guide/forms-overview)
3162 * @see [Template-driven Forms Guide](/guide/forms)
3163 *
3164 * @publicApi
3165 */
3166export declare class FormsModule {
3167 /**
3168 * @description
3169 * Provides options for configuring the forms module.
3170 *
3171 * @param opts An object of configuration options
3172 * * `callSetDisabledState` Configures whether to `always` call `setDisabledState`, which is more
3173 * correct, or to only call it `whenDisabled`, which is the legacy behavior.
3174 */
3175 static withConfig(opts: {
3176 callSetDisabledState?: SetDisabledStateOption;
3177 }): ModuleWithProviders<FormsModule>;
3178 static ɵfac: i0.ɵɵFactoryDeclaration<FormsModule, never>;
3179 static ɵmod: i0.ɵɵNgModuleDeclaration<FormsModule, [typeof i1_2.NgModel, typeof i2_2.NgModelGroup, typeof i3_2.NgForm], never, [typeof i4_2.ɵInternalFormsSharedModule, typeof i1_2.NgModel, typeof i2_2.NgModelGroup, typeof i3_2.NgForm]>;
3180 static ɵinj: i0.ɵɵInjectorDeclaration<FormsModule>;
3181}
3182
3183declare namespace i1 {
3184 export {
3185 ɵNgNoValidate,
3186 ɵNgNoValidate as NgNoValidate
3187 }
3188}
3189
3190declare namespace i10 {
3191 export {
3192 ValidationErrors,
3193 Validator,
3194 MAX_VALIDATOR,
3195 MaxValidator,
3196 MIN_VALIDATOR,
3197 MinValidator,
3198 AsyncValidator,
3199 REQUIRED_VALIDATOR,
3200 CHECKBOX_REQUIRED_VALIDATOR,
3201 RequiredValidator,
3202 CheckboxRequiredValidator,
3203 EMAIL_VALIDATOR,
3204 EmailValidator,
3205 ValidatorFn,
3206 AsyncValidatorFn,
3207 MIN_LENGTH_VALIDATOR,
3208 MinLengthValidator,
3209 MAX_LENGTH_VALIDATOR,
3210 MaxLengthValidator,
3211 PATTERN_VALIDATOR,
3212 PatternValidator
3213 }
3214}
3215
3216declare namespace i1_2 {
3217 export {
3218 NgModel
3219 }
3220}
3221
3222declare namespace i2 {
3223 export {
3224 SelectControlValueAccessor,
3225 NgSelectOption
3226 }
3227}
3228
3229declare namespace i2_2 {
3230 export {
3231 modelGroupProvider,
3232 NgModelGroup
3233 }
3234}
3235
3236declare namespace i3 {
3237 export {
3238 SelectMultipleControlValueAccessor,
3239 ɵNgSelectMultipleOption,
3240 ɵNgSelectMultipleOption as NgSelectMultipleOption
3241 }
3242}
3243
3244declare namespace i3_2 {
3245 export {
3246 NgForm
3247 }
3248}
3249
3250declare namespace i4 {
3251 export {
3252 DEFAULT_VALUE_ACCESSOR,
3253 COMPOSITION_BUFFER_MODE,
3254 DefaultValueAccessor
3255 }
3256}
3257
3258declare namespace i4_2 {
3259 export {
3260 CheckboxControlValueAccessor,
3261 ControlValueAccessor,
3262 DefaultValueAccessor,
3263 NgControl,
3264 NgControlStatus,
3265 NgControlStatusGroup,
3266 NgForm,
3267 NgModel,
3268 NgModelGroup,
3269 NumberValueAccessor,
3270 RadioControlValueAccessor,
3271 RangeValueAccessor,
3272 FormControlDirective,
3273 NG_MODEL_WITH_FORM_CONTROL_WARNING,
3274 FormControlName,
3275 FormGroupDirective,
3276 FormArrayName,
3277 FormGroupName,
3278 NgSelectOption,
3279 SelectControlValueAccessor,
3280 ɵNgSelectMultipleOption as NgSelectMultipleOption,
3281 SelectMultipleControlValueAccessor,
3282 CALL_SET_DISABLED_STATE,
3283 SHARED_FORM_DIRECTIVES,
3284 TEMPLATE_DRIVEN_DIRECTIVES,
3285 REACTIVE_DRIVEN_DIRECTIVES,
3286 ɵInternalFormsSharedModule,
3287 ɵInternalFormsSharedModule as InternalFormsSharedModule
3288 }
3289}
3290
3291declare namespace i5 {
3292 export {
3293 NumberValueAccessor
3294 }
3295}
3296
3297declare namespace i5_2 {
3298 export {
3299 NG_MODEL_WITH_FORM_CONTROL_WARNING,
3300 FormControlDirective
3301 }
3302}
3303
3304declare namespace i6 {
3305 export {
3306 RangeValueAccessor
3307 }
3308}
3309
3310declare namespace i6_2 {
3311 export {
3312 FormGroupDirective
3313 }
3314}
3315
3316declare namespace i7 {
3317 export {
3318 CheckboxControlValueAccessor
3319 }
3320}
3321
3322declare namespace i7_2 {
3323 export {
3324 FormControlName
3325 }
3326}
3327
3328declare namespace i8 {
3329 export {
3330 RadioControlRegistry,
3331 RadioControlValueAccessor
3332 }
3333}
3334
3335declare namespace i8_2 {
3336 export {
3337 FormGroupName,
3338 formArrayNameProvider,
3339 FormArrayName
3340 }
3341}
3342
3343declare namespace i9 {
3344 export {
3345 AbstractControlStatus,
3346 ngControlStatusHost,
3347 ngGroupStatusHost,
3348 NgControlStatus,
3349 NgControlStatusGroup
3350 }
3351}
3352
3353/**
3354 * @description
3355 * Asserts that the given control is an instance of `FormArray`
3356 *
3357 * @publicApi
3358 */
3359export declare const isFormArray: (control: unknown) => control is FormArray<any>;
3360
3361/**
3362 * @description
3363 * Asserts that the given control is an instance of `FormControl`
3364 *
3365 * @publicApi
3366 */
3367export declare const isFormControl: (control: unknown) => control is FormControl<any>;
3368
3369/**
3370 * @description
3371 * Asserts that the given control is an instance of `FormGroup`
3372 *
3373 * @publicApi
3374 */
3375export declare const isFormGroup: (control: unknown) => control is FormGroup<any>;
3376
3377/**
3378 * @description
3379 * Asserts that the given control is an instance of `FormRecord`
3380 *
3381 * @publicApi
3382 */
3383export declare const isFormRecord: (control: unknown) => control is FormRecord<AbstractControl<any, any>>;
3384
3385/**
3386 * @description
3387 * Provider which adds `MaxLengthValidator` to the `NG_VALIDATORS` multi-provider list.
3388 */
3389declare const MAX_LENGTH_VALIDATOR: any;
3390
3391/**
3392 * @description
3393 * Provider which adds `MaxValidator` to the `NG_VALIDATORS` multi-provider list.
3394 */
3395declare const MAX_VALIDATOR: Provider;
3396
3397/**
3398 * A directive that adds maximum length validation to controls marked with the
3399 * `maxlength` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list.
3400 *
3401 * @see [Form Validation](guide/form-validation)
3402 *
3403 * @usageNotes
3404 *
3405 * ### Adding a maximum length validator
3406 *
3407 * The following example shows how to add a maximum length validator to an input attached to an
3408 * ngModel binding.
3409 *
3410 * ```html
3411 * <input name="firstName" ngModel maxlength="25">
3412 * ```
3413 *
3414 * @ngModule ReactiveFormsModule
3415 * @ngModule FormsModule
3416 * @publicApi
3417 */
3418export declare class MaxLengthValidator extends AbstractValidatorDirective {
3419 /**
3420 * @description
3421 * Tracks changes to the maximum length bound to this directive.
3422 */
3423 maxlength: string | number | null;
3424 static ɵfac: i0.ɵɵFactoryDeclaration<MaxLengthValidator, never>;
3425 static ɵdir: i0.ɵɵDirectiveDeclaration<MaxLengthValidator, "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", never, { "maxlength": { "alias": "maxlength"; "required": false; }; }, {}, never, never, false, never>;
3426}
3427
3428/**
3429 * A directive which installs the {@link MaxValidator} for any `formControlName`,
3430 * `formControl`, or control with `ngModel` that also has a `max` attribute.
3431 *
3432 * @see [Form Validation](guide/form-validation)
3433 *
3434 * @usageNotes
3435 *
3436 * ### Adding a max validator
3437 *
3438 * The following example shows how to add a max validator to an input attached to an
3439 * ngModel binding.
3440 *
3441 * ```html
3442 * <input type="number" ngModel max="4">
3443 * ```
3444 *
3445 * @ngModule ReactiveFormsModule
3446 * @ngModule FormsModule
3447 * @publicApi
3448 */
3449export declare class MaxValidator extends AbstractValidatorDirective {
3450 /**
3451 * @description
3452 * Tracks changes to the max bound to this directive.
3453 */
3454 max: string | number | null;
3455 static ɵfac: i0.ɵɵFactoryDeclaration<MaxValidator, never>;
3456 static ɵdir: i0.ɵɵDirectiveDeclaration<MaxValidator, "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", never, { "max": { "alias": "max"; "required": false; }; }, {}, never, never, false, never>;
3457}
3458
3459/**
3460 * @description
3461 * Provider which adds `MinLengthValidator` to the `NG_VALIDATORS` multi-provider list.
3462 */
3463declare const MIN_LENGTH_VALIDATOR: any;
3464
3465/**
3466 * @description
3467 * Provider which adds `MinValidator` to the `NG_VALIDATORS` multi-provider list.
3468 */
3469declare const MIN_VALIDATOR: Provider;
3470
3471/**
3472 * A directive that adds minimum length validation to controls marked with the
3473 * `minlength` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list.
3474 *
3475 * @see [Form Validation](guide/form-validation)
3476 *
3477 * @usageNotes
3478 *
3479 * ### Adding a minimum length validator
3480 *
3481 * The following example shows how to add a minimum length validator to an input attached to an
3482 * ngModel binding.
3483 *
3484 * ```html
3485 * <input name="firstName" ngModel minlength="4">
3486 * ```
3487 *
3488 * @ngModule ReactiveFormsModule
3489 * @ngModule FormsModule
3490 * @publicApi
3491 */
3492export declare class MinLengthValidator extends AbstractValidatorDirective {
3493 /**
3494 * @description
3495 * Tracks changes to the minimum length bound to this directive.
3496 */
3497 minlength: string | number | null;
3498 static ɵfac: i0.ɵɵFactoryDeclaration<MinLengthValidator, never>;
3499 static ɵdir: i0.ɵɵDirectiveDeclaration<MinLengthValidator, "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", never, { "minlength": { "alias": "minlength"; "required": false; }; }, {}, never, never, false, never>;
3500}
3501
3502/**
3503 * A directive which installs the {@link MinValidator} for any `formControlName`,
3504 * `formControl`, or control with `ngModel` that also has a `min` attribute.
3505 *
3506 * @see [Form Validation](guide/form-validation)
3507 *
3508 * @usageNotes
3509 *
3510 * ### Adding a min validator
3511 *
3512 * The following example shows how to add a min validator to an input attached to an
3513 * ngModel binding.
3514 *
3515 * ```html
3516 * <input type="number" ngModel min="4">
3517 * ```
3518 *
3519 * @ngModule ReactiveFormsModule
3520 * @ngModule FormsModule
3521 * @publicApi
3522 */
3523export declare class MinValidator extends AbstractValidatorDirective {
3524 /**
3525 * @description
3526 * Tracks changes to the min bound to this directive.
3527 */
3528 min: string | number | null;
3529 static ɵfac: i0.ɵɵFactoryDeclaration<MinValidator, never>;
3530 static ɵdir: i0.ɵɵDirectiveDeclaration<MinValidator, "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", never, { "min": { "alias": "min"; "required": false; }; }, {}, never, never, false, never>;
3531}
3532
3533declare const modelGroupProvider: any;
3534
3535/**
3536 * @description
3537 * An `InjectionToken` for registering additional asynchronous validators used with
3538 * `AbstractControl`s.
3539 *
3540 * @see {@link NG_VALIDATORS}
3541 *
3542 * @usageNotes
3543 *
3544 * ### Provide a custom async validator directive
3545 *
3546 * The following example implements the `AsyncValidator` interface to create an
3547 * async validator directive with a custom error key.
3548 *
3549 * ```typescript
3550 * @Directive({
3551 * selector: '[customAsyncValidator]',
3552 * providers: [{provide: NG_ASYNC_VALIDATORS, useExisting: CustomAsyncValidatorDirective, multi:
3553 * true}]
3554 * })
3555 * class CustomAsyncValidatorDirective implements AsyncValidator {
3556 * validate(control: AbstractControl): Promise<ValidationErrors|null> {
3557 * return Promise.resolve({'custom': true});
3558 * }
3559 * }
3560 * ```
3561 *
3562 * @publicApi
3563 */
3564export declare const NG_ASYNC_VALIDATORS: InjectionToken<readonly (Function | Validator)[]>;
3565
3566/**
3567 * Token to provide to turn off the ngModel warning on formControl and formControlName.
3568 */
3569declare const NG_MODEL_WITH_FORM_CONTROL_WARNING: InjectionToken<unknown>;
3570
3571/**
3572 * @description
3573 * An `InjectionToken` for registering additional synchronous validators used with
3574 * `AbstractControl`s.
3575 *
3576 * @see {@link NG_ASYNC_VALIDATORS}
3577 *
3578 * @usageNotes
3579 *
3580 * ### Providing a custom validator
3581 *
3582 * The following example registers a custom validator directive. Adding the validator to the
3583 * existing collection of validators requires the `multi: true` option.
3584 *
3585 * ```typescript
3586 * @Directive({
3587 * selector: '[customValidator]',
3588 * providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}]
3589 * })
3590 * class CustomValidatorDirective implements Validator {
3591 * validate(control: AbstractControl): ValidationErrors | null {
3592 * return { 'custom': true };
3593 * }
3594 * }
3595 * ```
3596 *
3597 * @publicApi
3598 */
3599export declare const NG_VALIDATORS: InjectionToken<readonly (Function | Validator)[]>;
3600
3601/**
3602 * Used to provide a `ControlValueAccessor` for form controls.
3603 *
3604 * See `DefaultValueAccessor` for how to implement one.
3605 *
3606 * @publicApi
3607 */
3608export declare const NG_VALUE_ACCESSOR: InjectionToken<readonly ControlValueAccessor[]>;
3609
3610/**
3611 * @description
3612 * A base class that all `FormControl`-based directives extend. It binds a `FormControl`
3613 * object to a DOM element.
3614 *
3615 * @publicApi
3616 */
3617export declare abstract class NgControl extends AbstractControlDirective {
3618 /**
3619 * @description
3620 * The name for the control
3621 */
3622 name: string | number | null;
3623 /**
3624 * @description
3625 * The value accessor for the control
3626 */
3627 valueAccessor: ControlValueAccessor | null;
3628 /**
3629 * @description
3630 * The callback method to update the model from the view when requested
3631 *
3632 * @param newValue The new value for the view
3633 */
3634 abstract viewToModelUpdate(newValue: any): void;
3635}
3636
3637/**
3638 * @description
3639 * Directive automatically applied to Angular form controls that sets CSS classes
3640 * based on control status.
3641 *
3642 * @usageNotes
3643 *
3644 * ### CSS classes applied
3645 *
3646 * The following classes are applied as the properties become true:
3647 *
3648 * * ng-valid
3649 * * ng-invalid
3650 * * ng-pending
3651 * * ng-pristine
3652 * * ng-dirty
3653 * * ng-untouched
3654 * * ng-touched
3655 *
3656 * @ngModule ReactiveFormsModule
3657 * @ngModule FormsModule
3658 * @publicApi
3659 */
3660export declare class NgControlStatus extends AbstractControlStatus {
3661 constructor(cd: NgControl);
3662 static ɵfac: i0.ɵɵFactoryDeclaration<NgControlStatus, [{ self: true; }]>;
3663 static ɵdir: i0.ɵɵDirectiveDeclaration<NgControlStatus, "[formControlName],[ngModel],[formControl]", never, {}, {}, never, never, false, never>;
3664}
3665
3666/**
3667 * @description
3668 * Directive automatically applied to Angular form groups that sets CSS classes
3669 * based on control status (valid/invalid/dirty/etc). On groups, this includes the additional
3670 * class ng-submitted.
3671 *
3672 * @see {@link NgControlStatus}
3673 *
3674 * @ngModule ReactiveFormsModule
3675 * @ngModule FormsModule
3676 * @publicApi
3677 */
3678export declare class NgControlStatusGroup extends AbstractControlStatus {
3679 constructor(cd: ControlContainer);
3680 static ɵfac: i0.ɵɵFactoryDeclaration<NgControlStatusGroup, [{ optional: true; self: true; }]>;
3681 static ɵdir: i0.ɵɵDirectiveDeclaration<NgControlStatusGroup, "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]", never, {}, {}, never, never, false, never>;
3682}
3683
3684declare const ngControlStatusHost: {
3685 '[class.ng-untouched]': string;
3686 '[class.ng-touched]': string;
3687 '[class.ng-pristine]': string;
3688 '[class.ng-dirty]': string;
3689 '[class.ng-valid]': string;
3690 '[class.ng-invalid]': string;
3691 '[class.ng-pending]': string;
3692};
3693
3694/**
3695 * @description
3696 * Creates a top-level `FormGroup` instance and binds it to a form
3697 * to track aggregate form value and validation status.
3698 *
3699 * As soon as you import the `FormsModule`, this directive becomes active by default on
3700 * all `<form>` tags. You don't need to add a special selector.
3701 *
3702 * You optionally export the directive into a local template variable using `ngForm` as the key
3703 * (ex: `#myForm="ngForm"`). This is optional, but useful. Many properties from the underlying
3704 * `FormGroup` instance are duplicated on the directive itself, so a reference to it
3705 * gives you access to the aggregate value and validity status of the form, as well as
3706 * user interaction properties like `dirty` and `touched`.
3707 *
3708 * To register child controls with the form, use `NgModel` with a `name`
3709 * attribute. You may use `NgModelGroup` to create sub-groups within the form.
3710 *
3711 * If necessary, listen to the directive's `ngSubmit` event to be notified when the user has
3712 * triggered a form submission. The `ngSubmit` event emits the original form
3713 * submission event.
3714 *
3715 * In template driven forms, all `<form>` tags are automatically tagged as `NgForm`.
3716 * To import the `FormsModule` but skip its usage in some forms,
3717 * for example, to use native HTML5 validation, add the `ngNoForm` and the `<form>`
3718 * tags won't create an `NgForm` directive. In reactive forms, using `ngNoForm` is
3719 * unnecessary because the `<form>` tags are inert. In that case, you would
3720 * refrain from using the `formGroup` directive.
3721 *
3722 * @usageNotes
3723 *
3724 * ### Listening for form submission
3725 *
3726 * The following example shows how to capture the form values from the "ngSubmit" event.
3727 *
3728 * {@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
3729 *
3730 * ### Setting the update options
3731 *
3732 * The following example shows you how to change the "updateOn" option from its default using
3733 * ngFormOptions.
3734 *
3735 * ```html
3736 * <form [ngFormOptions]="{updateOn: 'blur'}">
3737 * <input name="one" ngModel> <!-- this ngModel will update on blur -->
3738 * </form>
3739 * ```
3740 *
3741 * ### Native DOM validation UI
3742 *
3743 * In order to prevent the native DOM form validation UI from interfering with Angular's form
3744 * validation, Angular automatically adds the `novalidate` attribute on any `<form>` whenever
3745 * `FormModule` or `ReactiveFormModule` are imported into the application.
3746 * If you want to explicitly enable native DOM validation UI with Angular forms, you can add the
3747 * `ngNativeValidate` attribute to the `<form>` element:
3748 *
3749 * ```html
3750 * <form ngNativeValidate>
3751 * ...
3752 * </form>
3753 * ```
3754 *
3755 * @ngModule FormsModule
3756 * @publicApi
3757 */
3758export declare class NgForm extends ControlContainer implements Form, AfterViewInit {
3759 private callSetDisabledState?;
3760 /**
3761 * @description
3762 * Returns whether the form submission has been triggered.
3763 */
3764 readonly submitted: boolean;
3765 private _directives;
3766 /**
3767 * @description
3768 * The `FormGroup` instance created for this form.
3769 */
3770 form: FormGroup;
3771 /**
3772 * @description
3773 * Event emitter for the "ngSubmit" event
3774 */
3775 ngSubmit: EventEmitter<any>;
3776 /**
3777 * @description
3778 * Tracks options for the `NgForm` instance.
3779 *
3780 * **updateOn**: Sets the default `updateOn` value for all child `NgModels` below it
3781 * unless explicitly set by a child `NgModel` using `ngModelOptions`). Defaults to 'change'.
3782 * Possible values: `'change'` | `'blur'` | `'submit'`.
3783 *
3784 */
3785 options: {
3786 updateOn?: FormHooks;
3787 };
3788 constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], callSetDisabledState?: SetDisabledStateOption | undefined);
3789 /** @nodoc */
3790 ngAfterViewInit(): void;
3791 /**
3792 * @description
3793 * The directive instance.
3794 */
3795 get formDirective(): Form;
3796 /**
3797 * @description
3798 * The internal `FormGroup` instance.
3799 */
3800 get control(): FormGroup;
3801 /**
3802 * @description
3803 * Returns an array representing the path to this group. Because this directive
3804 * always lives at the top level of a form, it is always an empty array.
3805 */
3806 get path(): string[];
3807 /**
3808 * @description
3809 * Returns a map of the controls in this group.
3810 */
3811 get controls(): {
3812 [key: string]: AbstractControl;
3813 };
3814 /**
3815 * @description
3816 * Method that sets up the control directive in this group, re-calculates its value
3817 * and validity, and adds the instance to the internal list of directives.
3818 *
3819 * @param dir The `NgModel` directive instance.
3820 */
3821 addControl(dir: NgModel): void;
3822 /**
3823 * @description
3824 * Retrieves the `FormControl` instance from the provided `NgModel` directive.
3825 *
3826 * @param dir The `NgModel` directive instance.
3827 */
3828 getControl(dir: NgModel): FormControl;
3829 /**
3830 * @description
3831 * Removes the `NgModel` instance from the internal list of directives
3832 *
3833 * @param dir The `NgModel` directive instance.
3834 */
3835 removeControl(dir: NgModel): void;
3836 /**
3837 * @description
3838 * Adds a new `NgModelGroup` directive instance to the form.
3839 *
3840 * @param dir The `NgModelGroup` directive instance.
3841 */
3842 addFormGroup(dir: NgModelGroup): void;
3843 /**
3844 * @description
3845 * Removes the `NgModelGroup` directive instance from the form.
3846 *
3847 * @param dir The `NgModelGroup` directive instance.
3848 */
3849 removeFormGroup(dir: NgModelGroup): void;
3850 /**
3851 * @description
3852 * Retrieves the `FormGroup` for a provided `NgModelGroup` directive instance
3853 *
3854 * @param dir The `NgModelGroup` directive instance.
3855 */
3856 getFormGroup(dir: NgModelGroup): FormGroup;
3857 /**
3858 * Sets the new value for the provided `NgControl` directive.
3859 *
3860 * @param dir The `NgControl` directive instance.
3861 * @param value The new value for the directive's control.
3862 */
3863 updateModel(dir: NgControl, value: any): void;
3864 /**
3865 * @description
3866 * Sets the value for this `FormGroup`.
3867 *
3868 * @param value The new value
3869 */
3870 setValue(value: {
3871 [key: string]: any;
3872 }): void;
3873 /**
3874 * @description
3875 * Method called when the "submit" event is triggered on the form.
3876 * Triggers the `ngSubmit` emitter to emit the "submit" event as its payload.
3877 *
3878 * @param $event The "submit" event object
3879 */
3880 onSubmit($event: Event): boolean;
3881 /**
3882 * @description
3883 * Method called when the "reset" event is triggered on the form.
3884 */
3885 onReset(): void;
3886 /**
3887 * @description
3888 * Resets the form to an initial value and resets its submitted status.
3889 *
3890 * @param value The new value for the form.
3891 */
3892 resetForm(value?: any): void;
3893 private _setUpdateStrategy;
3894 private _findContainer;
3895 static ɵfac: i0.ɵɵFactoryDeclaration<NgForm, [{ optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }]>;
3896 static ɵdir: i0.ɵɵDirectiveDeclaration<NgForm, "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", ["ngForm"], { "options": { "alias": "ngFormOptions"; "required": false; }; }, { "ngSubmit": "ngSubmit"; }, never, never, false, never>;
3897}
3898
3899declare const ngGroupStatusHost: {
3900 '[class.ng-submitted]': string;
3901 '[class.ng-untouched]': string;
3902 '[class.ng-touched]': string;
3903 '[class.ng-pristine]': string;
3904 '[class.ng-dirty]': string;
3905 '[class.ng-valid]': string;
3906 '[class.ng-invalid]': string;
3907 '[class.ng-pending]': string;
3908};
3909
3910/**
3911 * @description
3912 * Creates a `FormControl` instance from a [domain
3913 * model](https://en.wikipedia.org/wiki/Domain_model) and binds it to a form control element.
3914 *
3915 * The `FormControl` instance tracks the value, user interaction, and
3916 * validation status of the control and keeps the view synced with the model. If used
3917 * within a parent form, the directive also registers itself with the form as a child
3918 * control.
3919 *
3920 * This directive is used by itself or as part of a larger form. Use the
3921 * `ngModel` selector to activate it.
3922 *
3923 * It accepts a domain model as an optional `Input`. If you have a one-way binding
3924 * to `ngModel` with `[]` syntax, changing the domain model's value in the component
3925 * class sets the value in the view. If you have a two-way binding with `[()]` syntax
3926 * (also known as 'banana-in-a-box syntax'), the value in the UI always syncs back to
3927 * the domain model in your class.
3928 *
3929 * To inspect the properties of the associated `FormControl` (like the validity state),
3930 * export the directive into a local template variable using `ngModel` as the key (ex:
3931 * `#myVar="ngModel"`). You can then access the control using the directive's `control` property.
3932 * However, the most commonly used properties (like `valid` and `dirty`) also exist on the control
3933 * for direct access. See a full list of properties directly available in
3934 * `AbstractControlDirective`.
3935 *
3936 * @see {@link RadioControlValueAccessor}
3937 * @see {@link SelectControlValueAccessor}
3938 *
3939 * @usageNotes
3940 *
3941 * ### Using ngModel on a standalone control
3942 *
3943 * The following examples show a simple standalone control using `ngModel`:
3944 *
3945 * {@example forms/ts/simpleNgModel/simple_ng_model_example.ts region='Component'}
3946 *
3947 * When using the `ngModel` within `<form>` tags, you'll also need to supply a `name` attribute
3948 * so that the control can be registered with the parent form under that name.
3949 *
3950 * In the context of a parent form, it's often unnecessary to include one-way or two-way binding,
3951 * as the parent form syncs the value for you. You access its properties by exporting it into a
3952 * local template variable using `ngForm` such as (`#f="ngForm"`). Use the variable where
3953 * needed on form submission.
3954 *
3955 * If you do need to populate initial values into your form, using a one-way binding for
3956 * `ngModel` tends to be sufficient as long as you use the exported form's value rather
3957 * than the domain model's value on submit.
3958 *
3959 * ### Using ngModel within a form
3960 *
3961 * The following example shows controls using `ngModel` within a form:
3962 *
3963 * {@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
3964 *
3965 * ### Using a standalone ngModel within a group
3966 *
3967 * The following example shows you how to use a standalone ngModel control
3968 * within a form. This controls the display of the form, but doesn't contain form data.
3969 *
3970 * ```html
3971 * <form>
3972 * <input name="login" ngModel placeholder="Login">
3973 * <input type="checkbox" ngModel [ngModelOptions]="{standalone: true}"> Show more options?
3974 * </form>
3975 * <!-- form value: {login: ''} -->
3976 * ```
3977 *
3978 * ### Setting the ngModel `name` attribute through options
3979 *
3980 * The following example shows you an alternate way to set the name attribute. Here,
3981 * an attribute identified as name is used within a custom form control component. To still be able
3982 * to specify the NgModel's name, you must specify it using the `ngModelOptions` input instead.
3983 *
3984 * ```html
3985 * <form>
3986 * <my-custom-form-control name="Nancy" ngModel [ngModelOptions]="{name: 'user'}">
3987 * </my-custom-form-control>
3988 * </form>
3989 * <!-- form value: {user: ''} -->
3990 * ```
3991 *
3992 * @ngModule FormsModule
3993 * @publicApi
3994 */
3995export declare class NgModel extends NgControl implements OnChanges, OnDestroy {
3996 private _changeDetectorRef?;
3997 private callSetDisabledState?;
3998 readonly control: FormControl;
3999 /** @nodoc */
4000 static ngAcceptInputType_isDisabled: boolean | string;
4001 /**
4002 * Internal reference to the view model value.
4003 * @nodoc
4004 */
4005 viewModel: any;
4006 /**
4007 * @description
4008 * Tracks the name bound to the directive. If a parent form exists, it
4009 * uses this name as a key to retrieve this control's value.
4010 */
4011 name: string;
4012 /**
4013 * @description
4014 * Tracks whether the control is disabled.
4015 */
4016 isDisabled: boolean;
4017 /**
4018 * @description
4019 * Tracks the value bound to this directive.
4020 */
4021 model: any;
4022 /**
4023 * @description
4024 * Tracks the configuration options for this `ngModel` instance.
4025 *
4026 * **name**: An alternative to setting the name attribute on the form control element. See
4027 * the [example](api/forms/NgModel#using-ngmodel-on-a-standalone-control) for using `NgModel`
4028 * as a standalone control.
4029 *
4030 * **standalone**: When set to true, the `ngModel` will not register itself with its parent form,
4031 * and acts as if it's not in the form. Defaults to false. If no parent form exists, this option
4032 * has no effect.
4033 *
4034 * **updateOn**: Defines the event upon which the form control value and validity update.
4035 * Defaults to 'change'. Possible values: `'change'` | `'blur'` | `'submit'`.
4036 *
4037 */
4038 options: {
4039 name?: string;
4040 standalone?: boolean;
4041 updateOn?: FormHooks;
4042 };
4043 /**
4044 * @description
4045 * Event emitter for producing the `ngModelChange` event after
4046 * the view model updates.
4047 */
4048 update: EventEmitter<any>;
4049 constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[], _changeDetectorRef?: ChangeDetectorRef | null | undefined, callSetDisabledState?: SetDisabledStateOption | undefined);
4050 /** @nodoc */
4051 ngOnChanges(changes: SimpleChanges): void;
4052 /** @nodoc */
4053 ngOnDestroy(): void;
4054 /**
4055 * @description
4056 * Returns an array that represents the path from the top-level form to this control.
4057 * Each index is the string name of the control on that level.
4058 */
4059 get path(): string[];
4060 /**
4061 * @description
4062 * The top-level directive for this control if present, otherwise null.
4063 */
4064 get formDirective(): any;
4065 /**
4066 * @description
4067 * Sets the new value for the view model and emits an `ngModelChange` event.
4068 *
4069 * @param newValue The new value emitted by `ngModelChange`.
4070 */
4071 viewToModelUpdate(newValue: any): void;
4072 private _setUpControl;
4073 private _setUpdateStrategy;
4074 private _isStandalone;
4075 private _setUpStandalone;
4076 private _checkForErrors;
4077 private _checkParentType;
4078 private _checkName;
4079 private _updateValue;
4080 private _updateDisabled;
4081 private _getPath;
4082 static ɵfac: i0.ɵɵFactoryDeclaration<NgModel, [{ optional: true; host: true; }, { optional: true; self: true; }, { optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }, { optional: true; }]>;
4083 static ɵdir: i0.ɵɵDirectiveDeclaration<NgModel, "[ngModel]:not([formControlName]):not([formControl])", ["ngModel"], { "name": { "alias": "name"; "required": false; }; "isDisabled": { "alias": "disabled"; "required": false; }; "model": { "alias": "ngModel"; "required": false; }; "options": { "alias": "ngModelOptions"; "required": false; }; }, { "update": "ngModelChange"; }, never, never, false, never>;
4084}
4085
4086/**
4087 * @description
4088 * Creates and binds a `FormGroup` instance to a DOM element.
4089 *
4090 * This directive can only be used as a child of `NgForm` (within `<form>` tags).
4091 *
4092 * Use this directive to validate a sub-group of your form separately from the
4093 * rest of your form, or if some values in your domain model make more sense
4094 * to consume together in a nested object.
4095 *
4096 * Provide a name for the sub-group and it will become the key
4097 * for the sub-group in the form's full value. If you need direct access, export the directive into
4098 * a local template variable using `ngModelGroup` (ex: `#myGroup="ngModelGroup"`).
4099 *
4100 * @usageNotes
4101 *
4102 * ### Consuming controls in a grouping
4103 *
4104 * The following example shows you how to combine controls together in a sub-group
4105 * of the form.
4106 *
4107 * {@example forms/ts/ngModelGroup/ng_model_group_example.ts region='Component'}
4108 *
4109 * @ngModule FormsModule
4110 * @publicApi
4111 */
4112export declare class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy {
4113 /**
4114 * @description
4115 * Tracks the name of the `NgModelGroup` bound to the directive. The name corresponds
4116 * to a key in the parent `NgForm`.
4117 */
4118 name: string;
4119 constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
4120 static ɵfac: i0.ɵɵFactoryDeclaration<NgModelGroup, [{ host: true; skipSelf: true; }, { optional: true; self: true; }, { optional: true; self: true; }]>;
4121 static ɵdir: i0.ɵɵDirectiveDeclaration<NgModelGroup, "[ngModelGroup]", ["ngModelGroup"], { "name": { "alias": "ngModelGroup"; "required": false; }; }, {}, never, never, false, never>;
4122}
4123
4124/**
4125 * @description
4126 * Marks `<option>` as dynamic, so Angular can be notified when options change.
4127 *
4128 * @see {@link SelectControlValueAccessor}
4129 *
4130 * @ngModule ReactiveFormsModule
4131 * @ngModule FormsModule
4132 * @publicApi
4133 */
4134export declare class NgSelectOption implements OnDestroy {
4135 private _element;
4136 private _renderer;
4137 private _select;
4138 /**
4139 * @description
4140 * ID of the option element
4141 */
4142 id: string;
4143 constructor(_element: ElementRef, _renderer: Renderer2, _select: SelectControlValueAccessor);
4144 /**
4145 * @description
4146 * Tracks the value bound to the option element. Unlike the value binding,
4147 * ngValue supports binding to objects.
4148 */
4149 set ngValue(value: any);
4150 /**
4151 * @description
4152 * Tracks simple string values bound to the option element.
4153 * For objects, use the `ngValue` input binding.
4154 */
4155 set value(value: any);
4156 /** @nodoc */
4157 ngOnDestroy(): void;
4158 static ɵfac: i0.ɵɵFactoryDeclaration<NgSelectOption, [null, null, { optional: true; host: true; }]>;
4159 static ɵdir: i0.ɵɵDirectiveDeclaration<NgSelectOption, "option", never, { "ngValue": { "alias": "ngValue"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, {}, never, never, false, never>;
4160}
4161
4162/**
4163 * @description
4164 * `NonNullableFormBuilder` is similar to {@link FormBuilder}, but automatically constructed
4165 * {@link FormControl} elements have `{nonNullable: true}` and are non-nullable.
4166 *
4167 * @publicApi
4168 */
4169export declare abstract class NonNullableFormBuilder {
4170 /**
4171 * Similar to `FormBuilder#group`, except any implicitly constructed `FormControl`
4172 * will be non-nullable (i.e. it will have `nonNullable` set to true). Note
4173 * that already-constructed controls will not be altered.
4174 */
4175 abstract group<T extends {}>(controls: T, options?: AbstractControlOptions | null): FormGroup<{
4176 [K in keyof T]: ɵElement<T[K], never>;
4177 }>;
4178 /**
4179 * Similar to `FormBuilder#record`, except any implicitly constructed `FormControl`
4180 * will be non-nullable (i.e. it will have `nonNullable` set to true). Note
4181 * that already-constructed controls will not be altered.
4182 */
4183 abstract record<T>(controls: {
4184 [key: string]: T;
4185 }, options?: AbstractControlOptions | null): FormRecord<ɵElement<T, never>>;
4186 /**
4187 * Similar to `FormBuilder#array`, except any implicitly constructed `FormControl`
4188 * will be non-nullable (i.e. it will have `nonNullable` set to true). Note
4189 * that already-constructed controls will not be altered.
4190 */
4191 abstract array<T>(controls: Array<T>, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): FormArray<ɵElement<T, never>>;
4192 /**
4193 * Similar to `FormBuilder#control`, except this overridden version of `control` forces
4194 * `nonNullable` to be `true`, resulting in the control always being non-nullable.
4195 */
4196 abstract control<T>(formState: T | FormControlState<T>, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): FormControl<T>;
4197 static ɵfac: i0.ɵɵFactoryDeclaration<NonNullableFormBuilder, never>;
4198 static ɵprov: i0.ɵɵInjectableDeclaration<NonNullableFormBuilder>;
4199}
4200
4201/**
4202 * @description
4203 * The `ControlValueAccessor` for writing a number value and listening to number input changes.
4204 * The value accessor is used by the `FormControlDirective`, `FormControlName`, and `NgModel`
4205 * directives.
4206 *
4207 * @usageNotes
4208 *
4209 * ### Using a number input with a reactive form.
4210 *
4211 * The following example shows how to use a number input with a reactive form.
4212 *
4213 * ```ts
4214 * const totalCountControl = new FormControl();
4215 * ```
4216 *
4217 * ```
4218 * <input type="number" [formControl]="totalCountControl">
4219 * ```
4220 *
4221 * @ngModule ReactiveFormsModule
4222 * @ngModule FormsModule
4223 * @publicApi
4224 */
4225export declare class NumberValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor {
4226 /**
4227 * Sets the "value" property on the input element.
4228 * @nodoc
4229 */
4230 writeValue(value: number): void;
4231 /**
4232 * Registers a function called when the control value changes.
4233 * @nodoc
4234 */
4235 registerOnChange(fn: (_: number | null) => void): void;
4236 static ɵfac: i0.ɵɵFactoryDeclaration<NumberValueAccessor, never>;
4237 static ɵdir: i0.ɵɵDirectiveDeclaration<NumberValueAccessor, "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]", never, {}, {}, never, never, false, never>;
4238}
4239
4240/**
4241 * @description
4242 * Provider which adds `PatternValidator` to the `NG_VALIDATORS` multi-provider list.
4243 */
4244declare const PATTERN_VALIDATOR: any;
4245
4246/**
4247 * @description
4248 * A directive that adds regex pattern validation to controls marked with the
4249 * `pattern` attribute. The regex must match the entire control value.
4250 * The directive is provided with the `NG_VALIDATORS` multi-provider list.
4251 *
4252 * @see [Form Validation](guide/form-validation)
4253 *
4254 * @usageNotes
4255 *
4256 * ### Adding a pattern validator
4257 *
4258 * The following example shows how to add a pattern validator to an input attached to an
4259 * ngModel binding.
4260 *
4261 * ```html
4262 * <input name="firstName" ngModel pattern="[a-zA-Z ]*">
4263 * ```
4264 *
4265 * @ngModule ReactiveFormsModule
4266 * @ngModule FormsModule
4267 * @publicApi
4268 */
4269export declare class PatternValidator extends AbstractValidatorDirective {
4270 /**
4271 * @description
4272 * Tracks changes to the pattern bound to this directive.
4273 */
4274 pattern: string | RegExp;
4275 static ɵfac: i0.ɵɵFactoryDeclaration<PatternValidator, never>;
4276 static ɵdir: i0.ɵɵDirectiveDeclaration<PatternValidator, "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", never, { "pattern": { "alias": "pattern"; "required": false; }; }, {}, never, never, false, never>;
4277}
4278
4279/**
4280 * Helper type to allow the compiler to accept [XXXX, { updateOn: string }] as a valid shorthand
4281 * argument for .group()
4282 */
4283declare interface PermissiveAbstractControlOptions extends Omit<AbstractControlOptions, 'updateOn'> {
4284 updateOn?: string;
4285}
4286
4287/**
4288 * The compiler may not always be able to prove that the elements of the control config are a tuple
4289 * (i.e. occur in a fixed order). This slightly looser type is used for inference, to catch cases
4290 * where the compiler cannot prove order and position.
4291 *
4292 * For example, consider the simple case `fb.group({foo: ['bar', Validators.required]})`. The
4293 * compiler will infer this as an array, not as a tuple.
4294 */
4295declare type PermissiveControlConfig<T> = Array<T | FormControlState<T> | ValidatorConfig>;
4296
4297/**
4298 * @description
4299 * Class used by Angular to track radio buttons. For internal use only.
4300 */
4301declare class RadioControlRegistry {
4302 private _accessors;
4303 /**
4304 * @description
4305 * Adds a control to the internal registry. For internal use only.
4306 */
4307 add(control: NgControl, accessor: RadioControlValueAccessor): void;
4308 /**
4309 * @description
4310 * Removes a control from the internal registry. For internal use only.
4311 */
4312 remove(accessor: RadioControlValueAccessor): void;
4313 /**
4314 * @description
4315 * Selects a radio button. For internal use only.
4316 */
4317 select(accessor: RadioControlValueAccessor): void;
4318 private _isSameGroup;
4319 static ɵfac: i0.ɵɵFactoryDeclaration<RadioControlRegistry, never>;
4320 static ɵprov: i0.ɵɵInjectableDeclaration<RadioControlRegistry>;
4321}
4322
4323/**
4324 * @description
4325 * The `ControlValueAccessor` for writing radio control values and listening to radio control
4326 * changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and
4327 * `NgModel` directives.
4328 *
4329 * @usageNotes
4330 *
4331 * ### Using radio buttons with reactive form directives
4332 *
4333 * The follow example shows how to use radio buttons in a reactive form. When using radio buttons in
4334 * a reactive form, radio buttons in the same group should have the same `formControlName`.
4335 * Providing a `name` attribute is optional.
4336 *
4337 * {@example forms/ts/reactiveRadioButtons/reactive_radio_button_example.ts region='Reactive'}
4338 *
4339 * @ngModule ReactiveFormsModule
4340 * @ngModule FormsModule
4341 * @publicApi
4342 */
4343export declare class RadioControlValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor, OnDestroy, OnInit {
4344 private _registry;
4345 private _injector;
4346 private setDisabledStateFired;
4347 /**
4348 * The registered callback function called when a change event occurs on the input element.
4349 * Note: we declare `onChange` here (also used as host listener) as a function with no arguments
4350 * to override the `onChange` function (which expects 1 argument) in the parent
4351 * `BaseControlValueAccessor` class.
4352 * @nodoc
4353 */
4354 onChange: () => void;
4355 /**
4356 * @description
4357 * Tracks the name of the radio input element.
4358 */
4359 name: string;
4360 /**
4361 * @description
4362 * Tracks the name of the `FormControl` bound to the directive. The name corresponds
4363 * to a key in the parent `FormGroup` or `FormArray`.
4364 */
4365 formControlName: string;
4366 /**
4367 * @description
4368 * Tracks the value of the radio input element
4369 */
4370 value: any;
4371 private callSetDisabledState;
4372 constructor(renderer: Renderer2, elementRef: ElementRef, _registry: RadioControlRegistry, _injector: Injector);
4373 /** @nodoc */
4374 ngOnInit(): void;
4375 /** @nodoc */
4376 ngOnDestroy(): void;
4377 /**
4378 * Sets the "checked" property value on the radio input element.
4379 * @nodoc
4380 */
4381 writeValue(value: any): void;
4382 /**
4383 * Registers a function called when the control value changes.
4384 * @nodoc
4385 */
4386 registerOnChange(fn: (_: any) => {}): void;
4387 /** @nodoc */
4388 setDisabledState(isDisabled: boolean): void;
4389 /**
4390 * Sets the "value" on the radio input element and unchecks it.
4391 *
4392 * @param value
4393 */
4394 fireUncheck(value: any): void;
4395 private _checkName;
4396 static ɵfac: i0.ɵɵFactoryDeclaration<RadioControlValueAccessor, never>;
4397 static ɵdir: i0.ɵɵDirectiveDeclaration<RadioControlValueAccessor, "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", never, { "name": { "alias": "name"; "required": false; }; "formControlName": { "alias": "formControlName"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, {}, never, never, false, never>;
4398}
4399
4400/**
4401 * @description
4402 * The `ControlValueAccessor` for writing a range value and listening to range input changes.
4403 * The value accessor is used by the `FormControlDirective`, `FormControlName`, and `NgModel`
4404 * directives.
4405 *
4406 * @usageNotes
4407 *
4408 * ### Using a range input with a reactive form
4409 *
4410 * The following example shows how to use a range input with a reactive form.
4411 *
4412 * ```ts
4413 * const ageControl = new FormControl();
4414 * ```
4415 *
4416 * ```
4417 * <input type="range" [formControl]="ageControl">
4418 * ```
4419 *
4420 * @ngModule ReactiveFormsModule
4421 * @ngModule FormsModule
4422 * @publicApi
4423 */
4424export declare class RangeValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor {
4425 /**
4426 * Sets the "value" property on the input element.
4427 * @nodoc
4428 */
4429 writeValue(value: any): void;
4430 /**
4431 * Registers a function called when the control value changes.
4432 * @nodoc
4433 */
4434 registerOnChange(fn: (_: number | null) => void): void;
4435 static ɵfac: i0.ɵɵFactoryDeclaration<RangeValueAccessor, never>;
4436 static ɵdir: i0.ɵɵDirectiveDeclaration<RangeValueAccessor, "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]", never, {}, {}, never, never, false, never>;
4437}
4438
4439declare const REACTIVE_DRIVEN_DIRECTIVES: Type<any>[];
4440
4441/**
4442 * Exports the required infrastructure and directives for reactive forms,
4443 * making them available for import by NgModules that import this module.
4444 *
4445 * @see [Forms Overview](guide/forms-overview)
4446 * @see [Reactive Forms Guide](guide/reactive-forms)
4447 *
4448 * @publicApi
4449 */
4450export declare class ReactiveFormsModule {
4451 /**
4452 * @description
4453 * Provides options for configuring the reactive forms module.
4454 *
4455 * @param opts An object of configuration options
4456 * * `warnOnNgModelWithFormControl` Configures when to emit a warning when an `ngModel`
4457 * binding is used with reactive form directives.
4458 * * `callSetDisabledState` Configures whether to `always` call `setDisabledState`, which is more
4459 * correct, or to only call it `whenDisabled`, which is the legacy behavior.
4460 */
4461 static withConfig(opts: {
4462 /** @deprecated as of v6 */ warnOnNgModelWithFormControl?: 'never' | 'once' | 'always';
4463 callSetDisabledState?: SetDisabledStateOption;
4464 }): ModuleWithProviders<ReactiveFormsModule>;
4465 static ɵfac: i0.ɵɵFactoryDeclaration<ReactiveFormsModule, never>;
4466 static ɵmod: i0.ɵɵNgModuleDeclaration<ReactiveFormsModule, [typeof i5_2.FormControlDirective, typeof i6_2.FormGroupDirective, typeof i7_2.FormControlName, typeof i8_2.FormGroupName, typeof i8_2.FormArrayName], never, [typeof i4_2.ɵInternalFormsSharedModule, typeof i5_2.FormControlDirective, typeof i6_2.FormGroupDirective, typeof i7_2.FormControlName, typeof i8_2.FormGroupName, typeof i8_2.FormArrayName]>;
4467 static ɵinj: i0.ɵɵInjectorDeclaration<ReactiveFormsModule>;
4468}
4469
4470/**
4471 * @description
4472 * Provider which adds `RequiredValidator` to the `NG_VALIDATORS` multi-provider list.
4473 */
4474declare const REQUIRED_VALIDATOR: Provider;
4475
4476/**
4477 * @description
4478 * A directive that adds the `required` validator to any controls marked with the
4479 * `required` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list.
4480 *
4481 * @see [Form Validation](guide/form-validation)
4482 *
4483 * @usageNotes
4484 *
4485 * ### Adding a required validator using template-driven forms
4486 *
4487 * ```
4488 * <input name="fullName" ngModel required>
4489 * ```
4490 *
4491 * @ngModule FormsModule
4492 * @ngModule ReactiveFormsModule
4493 * @publicApi
4494 */
4495export declare class RequiredValidator extends AbstractValidatorDirective {
4496 /**
4497 * @description
4498 * Tracks changes to the required attribute bound to this directive.
4499 */
4500 required: boolean | string;
4501 /** @nodoc */
4502 enabled(input: boolean): boolean;
4503 static ɵfac: i0.ɵɵFactoryDeclaration<RequiredValidator, never>;
4504 static ɵdir: i0.ɵɵDirectiveDeclaration<RequiredValidator, ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", never, { "required": { "alias": "required"; "required": false; }; }, {}, never, never, false, never>;
4505}
4506
4507/**
4508 * @description
4509 * The `ControlValueAccessor` for writing select control values and listening to select control
4510 * changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and
4511 * `NgModel` directives.
4512 *
4513 * @usageNotes
4514 *
4515 * ### Using select controls in a reactive form
4516 *
4517 * The following examples show how to use a select control in a reactive form.
4518 *
4519 * {@example forms/ts/reactiveSelectControl/reactive_select_control_example.ts region='Component'}
4520 *
4521 * ### Using select controls in a template-driven form
4522 *
4523 * To use a select in a template-driven form, simply add an `ngModel` and a `name`
4524 * attribute to the main `<select>` tag.
4525 *
4526 * {@example forms/ts/selectControl/select_control_example.ts region='Component'}
4527 *
4528 * ### Customizing option selection
4529 *
4530 * Angular uses object identity to select option. It's possible for the identities of items
4531 * to change while the data does not. This can happen, for example, if the items are produced
4532 * from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the
4533 * second response will produce objects with different identities.
4534 *
4535 * To customize the default option comparison algorithm, `<select>` supports `compareWith` input.
4536 * `compareWith` takes a **function** which has two arguments: `option1` and `option2`.
4537 * If `compareWith` is given, Angular selects option by the return value of the function.
4538 *
4539 * ```ts
4540 * const selectedCountriesControl = new FormControl();
4541 * ```
4542 *
4543 * ```
4544 * <select [compareWith]="compareFn" [formControl]="selectedCountriesControl">
4545 * <option *ngFor="let country of countries" [ngValue]="country">
4546 * {{country.name}}
4547 * </option>
4548 * </select>
4549 *
4550 * compareFn(c1: Country, c2: Country): boolean {
4551 * return c1 && c2 ? c1.id === c2.id : c1 === c2;
4552 * }
4553 * ```
4554 *
4555 * **Note:** We listen to the 'change' event because 'input' events aren't fired
4556 * for selects in IE, see:
4557 * https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event#browser_compatibility
4558 *
4559 * @ngModule ReactiveFormsModule
4560 * @ngModule FormsModule
4561 * @publicApi
4562 */
4563export declare class SelectControlValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor {
4564 /** @nodoc */
4565 value: any;
4566 /**
4567 * @description
4568 * Tracks the option comparison algorithm for tracking identities when
4569 * checking for changes.
4570 */
4571 set compareWith(fn: (o1: any, o2: any) => boolean);
4572 private _compareWith;
4573 /**
4574 * Sets the "value" property on the select element.
4575 * @nodoc
4576 */
4577 writeValue(value: any): void;
4578 /**
4579 * Registers a function called when the control value changes.
4580 * @nodoc
4581 */
4582 registerOnChange(fn: (value: any) => any): void;
4583 static ɵfac: i0.ɵɵFactoryDeclaration<SelectControlValueAccessor, never>;
4584 static ɵdir: i0.ɵɵDirectiveDeclaration<SelectControlValueAccessor, "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", never, { "compareWith": { "alias": "compareWith"; "required": false; }; }, {}, never, never, false, never>;
4585}
4586
4587/**
4588 * @description
4589 * The `ControlValueAccessor` for writing multi-select control values and listening to multi-select
4590 * control changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and
4591 * `NgModel` directives.
4592 *
4593 * @see {@link SelectControlValueAccessor}
4594 *
4595 * @usageNotes
4596 *
4597 * ### Using a multi-select control
4598 *
4599 * The follow example shows you how to use a multi-select control with a reactive form.
4600 *
4601 * ```ts
4602 * const countryControl = new FormControl();
4603 * ```
4604 *
4605 * ```
4606 * <select multiple name="countries" [formControl]="countryControl">
4607 * <option *ngFor="let country of countries" [ngValue]="country">
4608 * {{ country.name }}
4609 * </option>
4610 * </select>
4611 * ```
4612 *
4613 * ### Customizing option selection
4614 *
4615 * To customize the default option comparison algorithm, `<select>` supports `compareWith` input.
4616 * See the `SelectControlValueAccessor` for usage.
4617 *
4618 * @ngModule ReactiveFormsModule
4619 * @ngModule FormsModule
4620 * @publicApi
4621 */
4622export declare class SelectMultipleControlValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor {
4623 /**
4624 * The current value.
4625 * @nodoc
4626 */
4627 value: any;
4628 /**
4629 * @description
4630 * Tracks the option comparison algorithm for tracking identities when
4631 * checking for changes.
4632 */
4633 set compareWith(fn: (o1: any, o2: any) => boolean);
4634 private _compareWith;
4635 /**
4636 * Sets the "value" property on one or of more of the select's options.
4637 * @nodoc
4638 */
4639 writeValue(value: any): void;
4640 /**
4641 * Registers a function called when the control value changes
4642 * and writes an array of the selected options.
4643 * @nodoc
4644 */
4645 registerOnChange(fn: (value: any) => any): void;
4646 static ɵfac: i0.ɵɵFactoryDeclaration<SelectMultipleControlValueAccessor, never>;
4647 static ɵdir: i0.ɵɵDirectiveDeclaration<SelectMultipleControlValueAccessor, "select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]", never, { "compareWith": { "alias": "compareWith"; "required": false; }; }, {}, never, never, false, never>;
4648}
4649
4650/**
4651 * The type for CALL_SET_DISABLED_STATE. If `always`, then ControlValueAccessor will always call
4652 * `setDisabledState` when attached, which is the most correct behavior. Otherwise, it will only be
4653 * called when disabled, which is the legacy behavior for compatibility.
4654 *
4655 * @publicApi
4656 * @see {@link FormsModule#withconfig}
4657 */
4658export declare type SetDisabledStateOption = 'whenDisabledForLegacyCode' | 'always';
4659
4660declare const SHARED_FORM_DIRECTIVES: Type<any>[];
4661
4662declare const TEMPLATE_DRIVEN_DIRECTIVES: Type<any>[];
4663
4664/**
4665 * UntypedFormArray is a non-strongly-typed version of `FormArray`, which
4666 * permits heterogenous controls.
4667 */
4668export declare type UntypedFormArray = FormArray<any>;
4669
4670export declare const UntypedFormArray: UntypedFormArrayCtor;
4671
4672declare interface UntypedFormArrayCtor {
4673 new (controls: AbstractControl[], validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): UntypedFormArray;
4674 /**
4675 * The presence of an explicit `prototype` property provides backwards-compatibility for apps that
4676 * manually inspect the prototype chain.
4677 */
4678 prototype: FormArray<any>;
4679}
4680
4681/**
4682 * UntypedFormBuilder is the same as `FormBuilder`, but it provides untyped controls.
4683 */
4684export declare class UntypedFormBuilder extends FormBuilder {
4685 /**
4686 * Like `FormBuilder#group`, except the resulting group is untyped.
4687 */
4688 group(controlsConfig: {
4689 [key: string]: any;
4690 }, options?: AbstractControlOptions | null): UntypedFormGroup;
4691 /**
4692 * @deprecated This API is not typesafe and can result in issues with Closure Compiler renaming.
4693 * Use the `FormBuilder#group` overload with `AbstractControlOptions` instead.
4694 */
4695 group(controlsConfig: {
4696 [key: string]: any;
4697 }, options: {
4698 [key: string]: any;
4699 }): UntypedFormGroup;
4700 /**
4701 * Like `FormBuilder#control`, except the resulting control is untyped.
4702 */
4703 control(formState: any, validatorOrOpts?: ValidatorFn | ValidatorFn[] | FormControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): UntypedFormControl;
4704 /**
4705 * Like `FormBuilder#array`, except the resulting array is untyped.
4706 */
4707 array(controlsConfig: any[], validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): UntypedFormArray;
4708 static ɵfac: i0.ɵɵFactoryDeclaration<UntypedFormBuilder, never>;
4709 static ɵprov: i0.ɵɵInjectableDeclaration<UntypedFormBuilder>;
4710}
4711
4712/**
4713 * UntypedFormControl is a non-strongly-typed version of `FormControl`.
4714 */
4715export declare type UntypedFormControl = FormControl<any>;
4716
4717export declare const UntypedFormControl: UntypedFormControlCtor;
4718
4719declare interface UntypedFormControlCtor {
4720 new (): UntypedFormControl;
4721 new (formState?: any, validatorOrOpts?: ValidatorFn | ValidatorFn[] | FormControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): UntypedFormControl;
4722 /**
4723 * The presence of an explicit `prototype` property provides backwards-compatibility for apps that
4724 * manually inspect the prototype chain.
4725 */
4726 prototype: FormControl<any>;
4727}
4728
4729/**
4730 * UntypedFormGroup is a non-strongly-typed version of `FormGroup`.
4731 */
4732export declare type UntypedFormGroup = FormGroup<any>;
4733
4734export declare const UntypedFormGroup: UntypedFormGroupCtor;
4735
4736declare interface UntypedFormGroupCtor {
4737 new (controls: {
4738 [key: string]: AbstractControl;
4739 }, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): UntypedFormGroup;
4740 /**
4741 * The presence of an explicit `prototype` property provides backwards-compatibility for apps that
4742 * manually inspect the prototype chain.
4743 */
4744 prototype: FormGroup<any>;
4745}
4746
4747/**
4748 * @description
4749 * Defines the map of errors returned from failed validation checks.
4750 *
4751 * @publicApi
4752 */
4753export declare type ValidationErrors = {
4754 [key: string]: any;
4755};
4756
4757/**
4758 * @description
4759 * An interface implemented by classes that perform synchronous validation.
4760 *
4761 * @usageNotes
4762 *
4763 * ### Provide a custom validator
4764 *
4765 * The following example implements the `Validator` interface to create a
4766 * validator directive with a custom error key.
4767 *
4768 * ```typescript
4769 * @Directive({
4770 * selector: '[customValidator]',
4771 * providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}]
4772 * })
4773 * class CustomValidatorDirective implements Validator {
4774 * validate(control: AbstractControl): ValidationErrors|null {
4775 * return {'custom': true};
4776 * }
4777 * }
4778 * ```
4779 *
4780 * @publicApi
4781 */
4782export declare interface Validator {
4783 /**
4784 * @description
4785 * Method that performs synchronous validation against the provided control.
4786 *
4787 * @param control The control to validate against.
4788 *
4789 * @returns A map of validation errors if validation fails,
4790 * otherwise null.
4791 */
4792 validate(control: AbstractControl): ValidationErrors | null;
4793 /**
4794 * @description
4795 * Registers a callback function to call when the validator inputs change.
4796 *
4797 * @param fn The callback function
4798 */
4799 registerOnValidatorChange?(fn: () => void): void;
4800}
4801
4802/**
4803 * The union of all validator types that can be accepted by a ControlConfig.
4804 */
4805declare type ValidatorConfig = ValidatorFn | AsyncValidatorFn | ValidatorFn[] | AsyncValidatorFn[];
4806
4807/**
4808 * @description
4809 * A function that receives a control and synchronously returns a map of
4810 * validation errors if present, otherwise null.
4811 *
4812 * @publicApi
4813 */
4814export declare interface ValidatorFn {
4815 (control: AbstractControl): ValidationErrors | null;
4816}
4817
4818/**
4819 * @description
4820 * Provides a set of built-in validators that can be used by form controls.
4821 *
4822 * A validator is a function that processes a `FormControl` or collection of
4823 * controls and returns an error map or null. A null map means that validation has passed.
4824 *
4825 * @see [Form Validation](/guide/form-validation)
4826 *
4827 * @publicApi
4828 */
4829export declare class Validators {
4830 /**
4831 * @description
4832 * Validator that requires the control's value to be greater than or equal to the provided number.
4833 *
4834 * @usageNotes
4835 *
4836 * ### Validate against a minimum of 3
4837 *
4838 * ```typescript
4839 * const control = new FormControl(2, Validators.min(3));
4840 *
4841 * console.log(control.errors); // {min: {min: 3, actual: 2}}
4842 * ```
4843 *
4844 * @returns A validator function that returns an error map with the
4845 * `min` property if the validation check fails, otherwise `null`.
4846 *
4847 * @see {@link updateValueAndValidity()}
4848 *
4849 */
4850 static min(min: number): ValidatorFn;
4851 /**
4852 * @description
4853 * Validator that requires the control's value to be less than or equal to the provided number.
4854 *
4855 * @usageNotes
4856 *
4857 * ### Validate against a maximum of 15
4858 *
4859 * ```typescript
4860 * const control = new FormControl(16, Validators.max(15));
4861 *
4862 * console.log(control.errors); // {max: {max: 15, actual: 16}}
4863 * ```
4864 *
4865 * @returns A validator function that returns an error map with the
4866 * `max` property if the validation check fails, otherwise `null`.
4867 *
4868 * @see {@link updateValueAndValidity()}
4869 *
4870 */
4871 static max(max: number): ValidatorFn;
4872 /**
4873 * @description
4874 * Validator that requires the control have a non-empty value.
4875 *
4876 * @usageNotes
4877 *
4878 * ### Validate that the field is non-empty
4879 *
4880 * ```typescript
4881 * const control = new FormControl('', Validators.required);
4882 *
4883 * console.log(control.errors); // {required: true}
4884 * ```
4885 *
4886 * @returns An error map with the `required` property
4887 * if the validation check fails, otherwise `null`.
4888 *
4889 * @see {@link updateValueAndValidity()}
4890 *
4891 */
4892 static required(control: AbstractControl): ValidationErrors | null;
4893 /**
4894 * @description
4895 * Validator that requires the control's value be true. This validator is commonly
4896 * used for required checkboxes.
4897 *
4898 * @usageNotes
4899 *
4900 * ### Validate that the field value is true
4901 *
4902 * ```typescript
4903 * const control = new FormControl('some value', Validators.requiredTrue);
4904 *
4905 * console.log(control.errors); // {required: true}
4906 * ```
4907 *
4908 * @returns An error map that contains the `required` property
4909 * set to `true` if the validation check fails, otherwise `null`.
4910 *
4911 * @see {@link updateValueAndValidity()}
4912 *
4913 */
4914 static requiredTrue(control: AbstractControl): ValidationErrors | null;
4915 /**
4916 * @description
4917 * Validator that requires the control's value pass an email validation test.
4918 *
4919 * Tests the value using a [regular
4920 * expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)
4921 * pattern suitable for common use cases. The pattern is based on the definition of a valid email
4922 * address in the [WHATWG HTML
4923 * specification](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address) with
4924 * some enhancements to incorporate more RFC rules (such as rules related to domain names and the
4925 * lengths of different parts of the address).
4926 *
4927 * The differences from the WHATWG version include:
4928 * - Disallow `local-part` (the part before the `@` symbol) to begin or end with a period (`.`).
4929 * - Disallow `local-part` to be longer than 64 characters.
4930 * - Disallow the whole address to be longer than 254 characters.
4931 *
4932 * If this pattern does not satisfy your business needs, you can use `Validators.pattern()` to
4933 * validate the value against a different pattern.
4934 *
4935 * @usageNotes
4936 *
4937 * ### Validate that the field matches a valid email pattern
4938 *
4939 * ```typescript
4940 * const control = new FormControl('bad@', Validators.email);
4941 *
4942 * console.log(control.errors); // {email: true}
4943 * ```
4944 *
4945 * @returns An error map with the `email` property
4946 * if the validation check fails, otherwise `null`.
4947 *
4948 * @see {@link updateValueAndValidity()}
4949 *
4950 */
4951 static email(control: AbstractControl): ValidationErrors | null;
4952 /**
4953 * @description
4954 * Validator that requires the length of the control's value to be greater than or equal
4955 * to the provided minimum length. This validator is also provided by default if you use the
4956 * the HTML5 `minlength` attribute. Note that the `minLength` validator is intended to be used
4957 * only for types that have a numeric `length` property, such as strings or arrays. The
4958 * `minLength` validator logic is also not invoked for values when their `length` property is 0
4959 * (for example in case of an empty string or an empty array), to support optional controls. You
4960 * can use the standard `required` validator if empty values should not be considered valid.
4961 *
4962 * @usageNotes
4963 *
4964 * ### Validate that the field has a minimum of 3 characters
4965 *
4966 * ```typescript
4967 * const control = new FormControl('ng', Validators.minLength(3));
4968 *
4969 * console.log(control.errors); // {minlength: {requiredLength: 3, actualLength: 2}}
4970 * ```
4971 *
4972 * ```html
4973 * <input minlength="5">
4974 * ```
4975 *
4976 * @returns A validator function that returns an error map with the
4977 * `minlength` property if the validation check fails, otherwise `null`.
4978 *
4979 * @see {@link updateValueAndValidity()}
4980 *
4981 */
4982 static minLength(minLength: number): ValidatorFn;
4983 /**
4984 * @description
4985 * Validator that requires the length of the control's value to be less than or equal
4986 * to the provided maximum length. This validator is also provided by default if you use the
4987 * the HTML5 `maxlength` attribute. Note that the `maxLength` validator is intended to be used
4988 * only for types that have a numeric `length` property, such as strings or arrays.
4989 *
4990 * @usageNotes
4991 *
4992 * ### Validate that the field has maximum of 5 characters
4993 *
4994 * ```typescript
4995 * const control = new FormControl('Angular', Validators.maxLength(5));
4996 *
4997 * console.log(control.errors); // {maxlength: {requiredLength: 5, actualLength: 7}}
4998 * ```
4999 *
5000 * ```html
5001 * <input maxlength="5">
5002 * ```
5003 *
5004 * @returns A validator function that returns an error map with the
5005 * `maxlength` property if the validation check fails, otherwise `null`.
5006 *
5007 * @see {@link updateValueAndValidity()}
5008 *
5009 */
5010 static maxLength(maxLength: number): ValidatorFn;
5011 /**
5012 * @description
5013 * Validator that requires the control's value to match a regex pattern. This validator is also
5014 * provided by default if you use the HTML5 `pattern` attribute.
5015 *
5016 * @usageNotes
5017 *
5018 * ### Validate that the field only contains letters or spaces
5019 *
5020 * ```typescript
5021 * const control = new FormControl('1', Validators.pattern('[a-zA-Z ]*'));
5022 *
5023 * console.log(control.errors); // {pattern: {requiredPattern: '^[a-zA-Z ]*$', actualValue: '1'}}
5024 * ```
5025 *
5026 * ```html
5027 * <input pattern="[a-zA-Z ]*">
5028 * ```
5029 *
5030 * ### Pattern matching with the global or sticky flag
5031 *
5032 * `RegExp` objects created with the `g` or `y` flags that are passed into `Validators.pattern`
5033 * can produce different results on the same input when validations are run consecutively. This is
5034 * due to how the behavior of `RegExp.prototype.test` is
5035 * specified in [ECMA-262](https://tc39.es/ecma262/#sec-regexpbuiltinexec)
5036 * (`RegExp` preserves the index of the last match when the global or sticky flag is used).
5037 * Due to this behavior, it is recommended that when using
5038 * `Validators.pattern` you **do not** pass in a `RegExp` object with either the global or sticky
5039 * flag enabled.
5040 *
5041 * ```typescript
5042 * // Not recommended (since the `g` flag is used)
5043 * const controlOne = new FormControl('1', Validators.pattern(/foo/g));
5044 *
5045 * // Good
5046 * const controlTwo = new FormControl('1', Validators.pattern(/foo/));
5047 * ```
5048 *
5049 * @param pattern A regular expression to be used as is to test the values, or a string.
5050 * If a string is passed, the `^` character is prepended and the `$` character is
5051 * appended to the provided string (if not already present), and the resulting regular
5052 * expression is used to test the values.
5053 *
5054 * @returns A validator function that returns an error map with the
5055 * `pattern` property if the validation check fails, otherwise `null`.
5056 *
5057 * @see {@link updateValueAndValidity()}
5058 *
5059 */
5060 static pattern(pattern: string | RegExp): ValidatorFn;
5061 /**
5062 * @description
5063 * Validator that performs no operation.
5064 *
5065 * @see {@link updateValueAndValidity()}
5066 *
5067 */
5068 static nullValidator(control: AbstractControl): ValidationErrors | null;
5069 /**
5070 * @description
5071 * Compose multiple validators into a single function that returns the union
5072 * of the individual error maps for the provided control.
5073 *
5074 * @returns A validator function that returns an error map with the
5075 * merged error maps of the validators if the validation check fails, otherwise `null`.
5076 *
5077 * @see {@link updateValueAndValidity()}
5078 *
5079 */
5080 static compose(validators: null): null;
5081 static compose(validators: (ValidatorFn | null | undefined)[]): ValidatorFn | null;
5082 /**
5083 * @description
5084 * Compose multiple async validators into a single function that returns the union
5085 * of the individual error objects for the provided control.
5086 *
5087 * @returns A validator function that returns an error map with the
5088 * merged error objects of the async validators if the validation check fails, otherwise `null`.
5089 *
5090 * @see {@link updateValueAndValidity()}
5091 *
5092 */
5093 static composeAsync(validators: (AsyncValidatorFn | null)[]): AsyncValidatorFn | null;
5094}
5095
5096/**
5097 * @publicApi
5098 */
5099export declare const VERSION: Version;
5100
5101/**
5102 * CoerceStrArrToNumArr accepts an array of strings, and converts any numeric string to a number.
5103 */
5104export declare type ɵCoerceStrArrToNumArr<S> = S extends [infer Head, ...infer Tail] ? Head extends `${number}` ? [
5105number,
5106...ɵCoerceStrArrToNumArr<Tail>
5107] : [
5108Head,
5109...ɵCoerceStrArrToNumArr<Tail>
5110] : [
5111];
5112
5113/**
5114 * FormBuilder accepts values in various container shapes, as well as raw values.
5115 * Element returns the appropriate corresponding model class, given the container T.
5116 * The flag N, if not never, makes the resulting `FormControl` have N in its type.
5117 */
5118export declare type ɵElement<T, N extends null> = [
5119T
5120] extends [FormControl<infer U>] ? FormControl<U> : [
5121T
5122] extends [FormControl<infer U> | undefined] ? FormControl<U> : [
5123T
5124] extends [FormGroup<infer U>] ? FormGroup<U> : [
5125T
5126] extends [FormGroup<infer U> | undefined] ? FormGroup<U> : [
5127T
5128] extends [FormRecord<infer U>] ? FormRecord<U> : [
5129T
5130] extends [FormRecord<infer U> | undefined] ? FormRecord<U> : [
5131T
5132] extends [FormArray<infer U>] ? FormArray<U> : [
5133T
5134] extends [FormArray<infer U> | undefined] ? FormArray<U> : [
5135T
5136] extends [AbstractControl<infer U>] ? AbstractControl<U> : [
5137T
5138] extends [AbstractControl<infer U> | undefined] ? AbstractControl<U> : [
5139T
5140] extends [FormControlState<infer U>] ? FormControl<U | N> : [
5141T
5142] extends [PermissiveControlConfig<infer U>] ? FormControl<Exclude<U, ValidatorConfig | PermissiveAbstractControlOptions> | N> : FormControl<T | N>;
5143
5144/**
5145 * FormArrayRawValue extracts the type of `.getRawValue()` from a FormArray's element type, and
5146 * wraps it in an array. The untyped case falls back to any[].
5147 *
5148 * Angular uses this type internally to support Typed Forms; do not use it directly.
5149 */
5150export declare type ɵFormArrayRawValue<T extends AbstractControl<any>> = ɵTypedOrUntyped<T, Array<ɵRawValue<T>>, any[]>;
5151
5152/**
5153 * FormArrayValue extracts the type of `.value` from a FormArray's element type, and wraps it in an
5154 * array.
5155 *
5156 * Angular uses this type internally to support Typed Forms; do not use it directly. The untyped
5157 * case falls back to any[].
5158 */
5159export declare type ɵFormArrayValue<T extends AbstractControl<any>> = ɵTypedOrUntyped<T, Array<ɵValue<T>>, any[]>;
5160
5161/**
5162 * Various available constructors for `FormControl`.
5163 * Do not use this interface directly. Instead, use `FormControl`:
5164 * ```
5165 * const fc = new FormControl('foo');
5166 * ```
5167 * This symbol is prefixed with ɵ to make plain that it is an internal symbol.
5168 */
5169export declare interface ɵFormControlCtor {
5170 /**
5171 * Construct a FormControl with no initial value or validators.
5172 */
5173 new (): FormControl<any>;
5174 /**
5175 * Creates a new `FormControl` instance.
5176 *
5177 * @param formState Initializes the control with an initial value,
5178 * or an object that defines the initial value and disabled state.
5179 *
5180 * @param validatorOrOpts A synchronous validator function, or an array of
5181 * such functions, or a `FormControlOptions` object that contains validation functions
5182 * and a validation trigger.
5183 *
5184 * @param asyncValidator A single async validator or array of async validator functions
5185 */
5186 new <T = any>(value: FormControlState<T> | T, opts: FormControlOptions & {
5187 nonNullable: true;
5188 }): FormControl<T>;
5189 /**
5190 * @deprecated Use `nonNullable` instead.
5191 */
5192 new <T = any>(value: FormControlState<T> | T, opts: FormControlOptions & {
5193 initialValueIsDefault: true;
5194 }): FormControl<T>;
5195 /**
5196 * @deprecated When passing an `options` argument, the `asyncValidator` argument has no effect.
5197 */
5198 new <T = any>(value: FormControlState<T> | T, opts: FormControlOptions, asyncValidator: AsyncValidatorFn | AsyncValidatorFn[]): FormControl<T | null>;
5199 new <T = any>(value: FormControlState<T> | T, validatorOrOpts?: ValidatorFn | ValidatorFn[] | FormControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): FormControl<T | null>;
5200 /**
5201 * The presence of an explicit `prototype` property provides backwards-compatibility for apps that
5202 * manually inspect the prototype chain.
5203 */
5204 prototype: FormControl<any>;
5205}
5206
5207/**
5208 * FormGroupRawValue extracts the type of `.getRawValue()` from a FormGroup's inner object type. The
5209 * untyped case falls back to {[key: string]: any}.
5210 *
5211 * Angular uses this type internally to support Typed Forms; do not use it directly.
5212 *
5213 * For internal use only.
5214 */
5215export declare type ɵFormGroupRawValue<T extends {
5216 [K in keyof T]?: AbstractControl<any>;
5217}> = ɵTypedOrUntyped<T, {
5218 [K in keyof T]: ɵRawValue<T[K]>;
5219}, {
5220 [key: string]: any;
5221}>;
5222
5223/**
5224 * FormGroupValue extracts the type of `.value` from a FormGroup's inner object type. The untyped
5225 * case falls back to {[key: string]: any}.
5226 *
5227 * Angular uses this type internally to support Typed Forms; do not use it directly.
5228 *
5229 * For internal use only.
5230 */
5231export declare type ɵFormGroupValue<T extends {
5232 [K in keyof T]?: AbstractControl<any>;
5233}> = ɵTypedOrUntyped<T, Partial<{
5234 [K in keyof T]: ɵValue<T[K]>;
5235}>, {
5236 [key: string]: any;
5237}>;
5238
5239/**
5240 * GetProperty takes a type T and some property names or indices K.
5241 * If K is a dot-separated string, it is tokenized into an array before proceeding.
5242 * Then, the type of the nested property at K is computed: T[K[0]][K[1]][K[2]]...
5243 * This works with both objects, which are indexed by property name, and arrays, which are indexed
5244 * numerically.
5245 *
5246 * For internal use only.
5247 */
5248export declare type ɵGetProperty<T, K> = K extends string ? ɵGetProperty<T, ɵCoerceStrArrToNumArr<ɵTokenize<K, '.'>>> : ɵWriteable<K> extends Array<string | number> ? ɵNavigate<T, ɵWriteable<K>> : any;
5249
5250/**
5251 * Internal module used for sharing directives between FormsModule and ReactiveFormsModule
5252 */
5253export declare class ɵInternalFormsSharedModule {
5254 static ɵfac: i0.ɵɵFactoryDeclaration<ɵInternalFormsSharedModule, never>;
5255 static ɵmod: i0.ɵɵNgModuleDeclaration<ɵInternalFormsSharedModule, [typeof i1.ɵNgNoValidate, typeof i2.NgSelectOption, typeof i3.ɵNgSelectMultipleOption, typeof i4.DefaultValueAccessor, typeof i5.NumberValueAccessor, typeof i6.RangeValueAccessor, typeof i7.CheckboxControlValueAccessor, typeof i2.SelectControlValueAccessor, typeof i3.SelectMultipleControlValueAccessor, typeof i8.RadioControlValueAccessor, typeof i9.NgControlStatus, typeof i9.NgControlStatusGroup, typeof i10.RequiredValidator, typeof i10.MinLengthValidator, typeof i10.MaxLengthValidator, typeof i10.PatternValidator, typeof i10.CheckboxRequiredValidator, typeof i10.EmailValidator, typeof i10.MinValidator, typeof i10.MaxValidator], never, [typeof i1.ɵNgNoValidate, typeof i2.NgSelectOption, typeof i3.ɵNgSelectMultipleOption, typeof i4.DefaultValueAccessor, typeof i5.NumberValueAccessor, typeof i6.RangeValueAccessor, typeof i7.CheckboxControlValueAccessor, typeof i2.SelectControlValueAccessor, typeof i3.SelectMultipleControlValueAccessor, typeof i8.RadioControlValueAccessor, typeof i9.NgControlStatus, typeof i9.NgControlStatusGroup, typeof i10.RequiredValidator, typeof i10.MinLengthValidator, typeof i10.MaxLengthValidator, typeof i10.PatternValidator, typeof i10.CheckboxRequiredValidator, typeof i10.EmailValidator, typeof i10.MinValidator, typeof i10.MaxValidator]>;
5256 static ɵinj: i0.ɵɵInjectorDeclaration<ɵInternalFormsSharedModule>;
5257}
5258
5259declare type ɵIsAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
5260
5261/**
5262 * Navigate takes a type T and an array K, and returns the type of T[K[0]][K[1]][K[2]]...
5263 */
5264export declare type ɵNavigate<T, K extends (Array<string | number>)> = T extends object ? (K extends [infer Head, ...infer Tail] ? (Head extends keyof T ? (Tail extends (string | number)[] ? [
5265] extends Tail ? T[Head] : (ɵNavigate<T[Head], Tail>) : any) : never) : any) : any;
5266
5267/**
5268 * @description
5269 *
5270 * Adds `novalidate` attribute to all forms by default.
5271 *
5272 * `novalidate` is used to disable browser's native form validation.
5273 *
5274 * If you want to use native validation with Angular forms, just add `ngNativeValidate` attribute:
5275 *
5276 * ```
5277 * <form ngNativeValidate></form>
5278 * ```
5279 *
5280 * @publicApi
5281 * @ngModule ReactiveFormsModule
5282 * @ngModule FormsModule
5283 */
5284export declare class ɵNgNoValidate {
5285 static ɵfac: i0.ɵɵFactoryDeclaration<ɵNgNoValidate, never>;
5286 static ɵdir: i0.ɵɵDirectiveDeclaration<ɵNgNoValidate, "form:not([ngNoForm]):not([ngNativeValidate])", never, {}, {}, never, never, false, never>;
5287}
5288
5289/**
5290 * @description
5291 * Marks `<option>` as dynamic, so Angular can be notified when options change.
5292 *
5293 * @see {@link SelectMultipleControlValueAccessor}
5294 *
5295 * @ngModule ReactiveFormsModule
5296 * @ngModule FormsModule
5297 * @publicApi
5298 */
5299export declare class ɵNgSelectMultipleOption implements OnDestroy {
5300 private _element;
5301 private _renderer;
5302 private _select;
5303 id: string;
5304 constructor(_element: ElementRef, _renderer: Renderer2, _select: SelectMultipleControlValueAccessor);
5305 /**
5306 * @description
5307 * Tracks the value bound to the option element. Unlike the value binding,
5308 * ngValue supports binding to objects.
5309 */
5310 set ngValue(value: any);
5311 /**
5312 * @description
5313 * Tracks simple string values bound to the option element.
5314 * For objects, use the `ngValue` input binding.
5315 */
5316 set value(value: any);
5317 /** @nodoc */
5318 ngOnDestroy(): void;
5319 static ɵfac: i0.ɵɵFactoryDeclaration<ɵNgSelectMultipleOption, [null, null, { optional: true; host: true; }]>;
5320 static ɵdir: i0.ɵɵDirectiveDeclaration<ɵNgSelectMultipleOption, "option", never, { "ngValue": { "alias": "ngValue"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, {}, never, never, false, never>;
5321}
5322
5323/**
5324 * OptionalKeys returns the union of all optional keys in the object.
5325 *
5326 * Angular uses this type internally to support Typed Forms; do not use it directly.
5327 */
5328export declare type ɵOptionalKeys<T> = {
5329 [K in keyof T]-?: undefined extends T[K] ? K : never;
5330}[keyof T];
5331
5332/**
5333 * RawValue gives the raw value type corresponding to a control type.
5334 *
5335 * Note that the resulting type will follow the same rules as `.getRawValue()` on your control,
5336 * group, or array. This means that all controls inside a group will be required, not optional,
5337 * regardless of their disabled state.
5338 *
5339 * You may also wish to use {@link ɵValue}, which will have `undefined` in group keys (which can be
5340 * disabled).
5341 *
5342 * @usageNotes
5343 *
5344 * ### `FormGroup` raw value type
5345 *
5346 * Imagine you have an interface defining the controls in your group. You can extract the shape of
5347 * the raw values as follows:
5348 *
5349 * ```ts
5350 * interface PartyFormControls {
5351 * address: FormControl<string>;
5352 * }
5353 *
5354 * // RawValue operates on controls; the object must be wrapped in a FormGroup.
5355 * type PartyFormValues = RawValue<FormGroup<PartyFormControls>>;
5356 * ```
5357 *
5358 * The resulting type is `{address: string}`. (Note the absence of `undefined`.)
5359 *
5360 * **Internal: not for public use.**
5361 */
5362export declare type ɵRawValue<T extends AbstractControl | undefined> = T extends AbstractControl<any, any> ? (T['setValue'] extends ((v: infer R) => void) ? R : never) : never;
5363
5364/**
5365 * Tokenize splits a string literal S by a delimiter D.
5366 */
5367export declare type ɵTokenize<S extends string, D extends string> = string extends S ? string[] : S extends `${infer T}${D}${infer U}` ? [T, ...ɵTokenize<U, D>] : [
5368S
5369];
5370
5371/**
5372 * `TypedOrUntyped` allows one of two different types to be selected, depending on whether the Forms
5373 * class it's applied to is typed or not.
5374 *
5375 * This is for internal Angular usage to support typed forms; do not directly use it.
5376 */
5377export declare type ɵTypedOrUntyped<T, Typed, Untyped> = ɵIsAny<T, Untyped, Typed>;
5378
5379/**
5380 * Value gives the value type corresponding to a control type.
5381 *
5382 * Note that the resulting type will follow the same rules as `.value` on your control, group, or
5383 * array, including `undefined` for each group element which might be disabled.
5384 *
5385 * If you are trying to extract a value type for a data model, you probably want {@link RawValue},
5386 * which will not have `undefined` in group keys.
5387 *
5388 * @usageNotes
5389 *
5390 * ### `FormControl` value type
5391 *
5392 * You can extract the value type of a single control:
5393 *
5394 * ```ts
5395 * type NameControl = FormControl<string>;
5396 * type NameValue = Value<NameControl>;
5397 * ```
5398 *
5399 * The resulting type is `string`.
5400 *
5401 * ### `FormGroup` value type
5402 *
5403 * Imagine you have an interface defining the controls in your group. You can extract the shape of
5404 * the values as follows:
5405 *
5406 * ```ts
5407 * interface PartyFormControls {
5408 * address: FormControl<string>;
5409 * }
5410 *
5411 * // Value operates on controls; the object must be wrapped in a FormGroup.
5412 * type PartyFormValues = Value<FormGroup<PartyFormControls>>;
5413 * ```
5414 *
5415 * The resulting type is `{address: string|undefined}`.
5416 *
5417 * ### `FormArray` value type
5418 *
5419 * You can extract values from FormArrays as well:
5420 *
5421 * ```ts
5422 * type GuestNamesControls = FormArray<FormControl<string>>;
5423 *
5424 * type NamesValues = Value<GuestNamesControls>;
5425 * ```
5426 *
5427 * The resulting type is `string[]`.
5428 *
5429 * **Internal: not for public use.**
5430 */
5431export declare type ɵValue<T extends AbstractControl | undefined> = T extends AbstractControl<any, any> ? T['value'] : never;
5432
5433/**
5434 * ɵWriteable removes readonly from all keys.
5435 */
5436export declare type ɵWriteable<T> = {
5437 -readonly [P in keyof T]: T[P];
5438};
5439
5440export { }
5441
\No newline at end of file