UNPKG

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