UNPKG

155 kBTypeScriptView Raw
1/**
2 * @license Angular v12.0.3
3 * (c) 2010-2021 Google LLC. https://angular.io/
4 * License: MIT
5 */
6
7import { AfterViewInit } from '@angular/core';
8import { ElementRef } from '@angular/core';
9import { EventEmitter } from '@angular/core';
10import { InjectionToken } from '@angular/core';
11import { Injector } from '@angular/core';
12import { ModuleWithProviders } from '@angular/core';
13import { Observable } from 'rxjs';
14import { OnChanges } from '@angular/core';
15import { OnDestroy } from '@angular/core';
16import { OnInit } from '@angular/core';
17import { Renderer2 } from '@angular/core';
18import { SimpleChanges } from '@angular/core';
19import { StaticProvider } from '@angular/core';
20import { Type } from '@angular/core';
21import { Version } from '@angular/core';
22
23/**
24 * This is the base class for `FormControl`, `FormGroup`, and `FormArray`.
25 *
26 * It provides some of the shared behavior that all controls and groups of controls have, like
27 * running validators, calculating status, and resetting state. It also defines the properties
28 * that are shared between all sub-classes, like `value`, `valid`, and `dirty`. It shouldn't be
29 * instantiated directly.
30 *
31 * @see [Forms Guide](/guide/forms)
32 * @see [Reactive Forms Guide](/guide/reactive-forms)
33 * @see [Dynamic Forms Guide](/guide/dynamic-form)
34 *
35 * @publicApi
36 */
37export declare abstract class AbstractControl {
38 private _parent;
39 private _asyncValidationSubscription;
40 /**
41 * The current value of the control.
42 *
43 * * For a `FormControl`, the current value.
44 * * For an enabled `FormGroup`, the values of enabled controls as an object
45 * with a key-value pair for each member of the group.
46 * * For a disabled `FormGroup`, the values of all controls as an object
47 * with a key-value pair for each member of the group.
48 * * For a `FormArray`, the values of enabled controls as an array.
49 *
50 */
51 readonly value: any;
52 /**
53 * Initialize the AbstractControl instance.
54 *
55 * @param validators The function or array of functions that is used to determine the validity of
56 * this control synchronously.
57 * @param asyncValidators The function or array of functions that is used to determine validity of
58 * this control asynchronously.
59 */
60 constructor(validators: ValidatorFn | ValidatorFn[] | null, asyncValidators: AsyncValidatorFn | AsyncValidatorFn[] | null);
61 /**
62 * The function that is used to determine the validity of this control synchronously.
63 */
64 get validator(): ValidatorFn | null;
65 set validator(validatorFn: ValidatorFn | null);
66 /**
67 * The function that is used to determine the validity of this control asynchronously.
68 */
69 get asyncValidator(): AsyncValidatorFn | null;
70 set asyncValidator(asyncValidatorFn: AsyncValidatorFn | null);
71 /**
72 * The parent control.
73 */
74 get parent(): FormGroup | FormArray | null;
75 /**
76 * The validation status of the control. There are four possible
77 * validation status values:
78 *
79 * * **VALID**: This control has passed all validation checks.
80 * * **INVALID**: This control has failed at least one validation check.
81 * * **PENDING**: This control is in the midst of conducting a validation check.
82 * * **DISABLED**: This control is exempt from validation checks.
83 *
84 * These status values are mutually exclusive, so a control cannot be
85 * both valid AND invalid or invalid AND disabled.
86 */
87 readonly status: string;
88 /**
89 * A control is `valid` when its `status` is `VALID`.
90 *
91 * @see {@link AbstractControl.status}
92 *
93 * @returns True if the control has passed all of its validation tests,
94 * false otherwise.
95 */
96 get valid(): boolean;
97 /**
98 * A control is `invalid` when its `status` is `INVALID`.
99 *
100 * @see {@link AbstractControl.status}
101 *
102 * @returns True if this control has failed one or more of its validation checks,
103 * false otherwise.
104 */
105 get invalid(): boolean;
106 /**
107 * A control is `pending` when its `status` is `PENDING`.
108 *
109 * @see {@link AbstractControl.status}
110 *
111 * @returns True if this control is in the process of conducting a validation check,
112 * false otherwise.
113 */
114 get pending(): boolean;
115 /**
116 * A control is `disabled` when its `status` is `DISABLED`.
117 *
118 * Disabled controls are exempt from validation checks and
119 * are not included in the aggregate value of their ancestor
120 * controls.
121 *
122 * @see {@link AbstractControl.status}
123 *
124 * @returns True if the control is disabled, false otherwise.
125 */
126 get disabled(): boolean;
127 /**
128 * A control is `enabled` as long as its `status` is not `DISABLED`.
129 *
130 * @returns True if the control has any status other than 'DISABLED',
131 * false if the status is 'DISABLED'.
132 *
133 * @see {@link AbstractControl.status}
134 *
135 */
136 get enabled(): boolean;
137 /**
138 * An object containing any errors generated by failing validation,
139 * or null if there are no errors.
140 */
141 readonly errors: ValidationErrors | null;
142 /**
143 * A control is `pristine` if the user has not yet changed
144 * the value in the UI.
145 *
146 * @returns True if the user has not yet changed the value in the UI; compare `dirty`.
147 * Programmatic changes to a control's value do not mark it dirty.
148 */
149 readonly pristine: boolean;
150 /**
151 * A control is `dirty` if the user has changed the value
152 * in the UI.
153 *
154 * @returns True if the user has changed the value of this control in the UI; compare `pristine`.
155 * Programmatic changes to a control's value do not mark it dirty.
156 */
157 get dirty(): boolean;
158 /**
159 * True if the control is marked as `touched`.
160 *
161 * A control is marked `touched` once the user has triggered
162 * a `blur` event on it.
163 */
164 readonly touched: boolean;
165 /**
166 * True if the control has not been marked as touched
167 *
168 * A control is `untouched` if the user has not yet triggered
169 * a `blur` event on it.
170 */
171 get untouched(): boolean;
172 /**
173 * A multicasting observable that emits an event every time the value of the control changes, in
174 * the UI or programmatically. It also emits an event each time you call enable() or disable()
175 * without passing along {emitEvent: false} as a function argument.
176 */
177 readonly valueChanges: Observable<any>;
178 /**
179 * A multicasting observable that emits an event every time the validation `status` of the control
180 * recalculates.
181 *
182 * @see {@link AbstractControl.status}
183 *
184 */
185 readonly statusChanges: Observable<any>;
186 /**
187 * Reports the update strategy of the `AbstractControl` (meaning
188 * the event on which the control updates itself).
189 * Possible values: `'change'` | `'blur'` | `'submit'`
190 * Default value: `'change'`
191 */
192 get updateOn(): FormHooks;
193 /**
194 * Sets the synchronous validators that are active on this control. Calling
195 * this overwrites any existing sync validators.
196 *
197 * When you add or remove a validator at run time, you must call
198 * `updateValueAndValidity()` for the new validation to take effect.
199 *
200 */
201 setValidators(newValidator: ValidatorFn | ValidatorFn[] | null): void;
202 /**
203 * Sets the async validators that are active on this control. Calling this
204 * overwrites any existing async validators.
205 *
206 * When you add or remove a validator at run time, you must call
207 * `updateValueAndValidity()` for the new validation to take effect.
208 *
209 */
210 setAsyncValidators(newValidator: AsyncValidatorFn | AsyncValidatorFn[] | null): void;
211 /**
212 * Empties out the sync validator list.
213 *
214 * When you add or remove a validator at run time, you must call
215 * `updateValueAndValidity()` for the new validation to take effect.
216 *
217 */
218 clearValidators(): void;
219 /**
220 * Empties out the async validator list.
221 *
222 * When you add or remove a validator at run time, you must call
223 * `updateValueAndValidity()` for the new validation to take effect.
224 *
225 */
226 clearAsyncValidators(): void;
227 /**
228 * Marks the control as `touched`. A control is touched by focus and
229 * blur events that do not change the value.
230 *
231 * @see `markAsUntouched()`
232 * @see `markAsDirty()`
233 * @see `markAsPristine()`
234 *
235 * @param opts Configuration options that determine how the control propagates changes
236 * and emits events after marking is applied.
237 * * `onlySelf`: When true, mark only this control. When false or not supplied,
238 * marks all direct ancestors. Default is false.
239 */
240 markAsTouched(opts?: {
241 onlySelf?: boolean;
242 }): void;
243 /**
244 * Marks the control and all its descendant controls as `touched`.
245 * @see `markAsTouched()`
246 */
247 markAllAsTouched(): void;
248 /**
249 * Marks the control as `untouched`.
250 *
251 * If the control has any children, also marks all children as `untouched`
252 * and recalculates the `touched` status of all parent controls.
253 *
254 * @see `markAsTouched()`
255 * @see `markAsDirty()`
256 * @see `markAsPristine()`
257 *
258 * @param opts Configuration options that determine how the control propagates changes
259 * and emits events after the marking is applied.
260 * * `onlySelf`: When true, mark only this control. When false or not supplied,
261 * marks all direct ancestors. Default is false.
262 */
263 markAsUntouched(opts?: {
264 onlySelf?: boolean;
265 }): void;
266 /**
267 * Marks the control as `dirty`. A control becomes dirty when
268 * the control's value is changed through the UI; compare `markAsTouched`.
269 *
270 * @see `markAsTouched()`
271 * @see `markAsUntouched()`
272 * @see `markAsPristine()`
273 *
274 * @param opts Configuration options that determine how the control propagates changes
275 * and emits events after marking is applied.
276 * * `onlySelf`: When true, mark only this control. When false or not supplied,
277 * marks all direct ancestors. Default is false.
278 */
279 markAsDirty(opts?: {
280 onlySelf?: boolean;
281 }): void;
282 /**
283 * Marks the control as `pristine`.
284 *
285 * If the control has any children, marks all children as `pristine`,
286 * and recalculates the `pristine` status of all parent
287 * controls.
288 *
289 * @see `markAsTouched()`
290 * @see `markAsUntouched()`
291 * @see `markAsDirty()`
292 *
293 * @param opts Configuration options that determine how the control emits events after
294 * marking is applied.
295 * * `onlySelf`: When true, mark only this control. When false or not supplied,
296 * marks all direct ancestors. Default is false.
297 */
298 markAsPristine(opts?: {
299 onlySelf?: boolean;
300 }): void;
301 /**
302 * Marks the control as `pending`.
303 *
304 * A control is pending while the control performs async validation.
305 *
306 * @see {@link AbstractControl.status}
307 *
308 * @param opts Configuration options that determine how the control propagates changes and
309 * emits events after marking is applied.
310 * * `onlySelf`: When true, mark only this control. When false or not supplied,
311 * marks all direct ancestors. Default is false.
312 * * `emitEvent`: When true or not supplied (the default), the `statusChanges`
313 * observable emits an event with the latest status the control is marked pending.
314 * When false, no events are emitted.
315 *
316 */
317 markAsPending(opts?: {
318 onlySelf?: boolean;
319 emitEvent?: boolean;
320 }): void;
321 /**
322 * Disables the control. This means the control is exempt from validation checks and
323 * excluded from the aggregate value of any parent. Its status is `DISABLED`.
324 *
325 * If the control has children, all children are also disabled.
326 *
327 * @see {@link AbstractControl.status}
328 *
329 * @param opts Configuration options that determine how the control propagates
330 * changes and emits events after the control is disabled.
331 * * `onlySelf`: When true, mark only this control. When false or not supplied,
332 * marks all direct ancestors. Default is false.
333 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
334 * `valueChanges`
335 * observables emit events with the latest status and value when the control is disabled.
336 * When false, no events are emitted.
337 */
338 disable(opts?: {
339 onlySelf?: boolean;
340 emitEvent?: boolean;
341 }): void;
342 /**
343 * Enables the control. This means the control is included in validation checks and
344 * the aggregate value of its parent. Its status recalculates based on its value and
345 * its validators.
346 *
347 * By default, if the control has children, all children are enabled.
348 *
349 * @see {@link AbstractControl.status}
350 *
351 * @param opts Configure options that control how the control propagates changes and
352 * emits events when marked as untouched
353 * * `onlySelf`: When true, mark only this control. When false or not supplied,
354 * marks all direct ancestors. Default is false.
355 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
356 * `valueChanges`
357 * observables emit events with the latest status and value when the control is enabled.
358 * When false, no events are emitted.
359 */
360 enable(opts?: {
361 onlySelf?: boolean;
362 emitEvent?: boolean;
363 }): void;
364 private _updateAncestors;
365 /**
366 * @param parent Sets the parent of the control
367 */
368 setParent(parent: FormGroup | FormArray): void;
369 /**
370 * Sets the value of the control. Abstract method (implemented in sub-classes).
371 */
372 abstract setValue(value: any, options?: Object): void;
373 /**
374 * Patches the value of the control. Abstract method (implemented in sub-classes).
375 */
376 abstract patchValue(value: any, options?: Object): void;
377 /**
378 * Resets the control. Abstract method (implemented in sub-classes).
379 */
380 abstract reset(value?: any, options?: Object): void;
381 /**
382 * Recalculates the value and validation status of the control.
383 *
384 * By default, it also updates the value and validity of its ancestors.
385 *
386 * @param opts Configuration options determine how the control propagates changes and emits events
387 * after updates and validity checks are applied.
388 * * `onlySelf`: When true, only update this control. When false or not supplied,
389 * update all direct ancestors. Default is false.
390 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
391 * `valueChanges`
392 * observables emit events with the latest status and value when the control is updated.
393 * When false, no events are emitted.
394 */
395 updateValueAndValidity(opts?: {
396 onlySelf?: boolean;
397 emitEvent?: boolean;
398 }): void;
399 private _setInitialStatus;
400 private _runValidator;
401 private _runAsyncValidator;
402 private _cancelExistingSubscription;
403 /**
404 * Sets errors on a form control when running validations manually, rather than automatically.
405 *
406 * Calling `setErrors` also updates the validity of the parent control.
407 *
408 * @usageNotes
409 *
410 * ### Manually set the errors for a control
411 *
412 * ```
413 * const login = new FormControl('someLogin');
414 * login.setErrors({
415 * notUnique: true
416 * });
417 *
418 * expect(login.valid).toEqual(false);
419 * expect(login.errors).toEqual({ notUnique: true });
420 *
421 * login.setValue('someOtherLogin');
422 *
423 * expect(login.valid).toEqual(true);
424 * ```
425 */
426 setErrors(errors: ValidationErrors | null, opts?: {
427 emitEvent?: boolean;
428 }): void;
429 /**
430 * Retrieves a child control given the control's name or path.
431 *
432 * @param path A dot-delimited string or array of string/number values that define the path to the
433 * control.
434 *
435 * @usageNotes
436 * ### Retrieve a nested control
437 *
438 * For example, to get a `name` control nested within a `person` sub-group:
439 *
440 * * `this.form.get('person.name');`
441 *
442 * -OR-
443 *
444 * * `this.form.get(['person', 'name']);`
445 *
446 * ### Retrieve a control in a FormArray
447 *
448 * When accessing an element inside a FormArray, you can use an element index.
449 * For example, to get a `price` control from the first element in an `items` array you can use:
450 *
451 * * `this.form.get('items.0.price');`
452 *
453 * -OR-
454 *
455 * * `this.form.get(['items', 0, 'price']);`
456 */
457 get(path: Array<string | number> | string): AbstractControl | null;
458 /**
459 * @description
460 * Reports error data for the control with the given path.
461 *
462 * @param errorCode The code of the error to check
463 * @param path A list of control names that designates how to move from the current control
464 * to the control that should be queried for errors.
465 *
466 * @usageNotes
467 * For example, for the following `FormGroup`:
468 *
469 * ```
470 * form = new FormGroup({
471 * address: new FormGroup({ street: new FormControl() })
472 * });
473 * ```
474 *
475 * The path to the 'street' control from the root form would be 'address' -> 'street'.
476 *
477 * It can be provided to this method in one of two formats:
478 *
479 * 1. An array of string control names, e.g. `['address', 'street']`
480 * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
481 *
482 * @returns error data for that particular error. If the control or error is not present,
483 * null is returned.
484 */
485 getError(errorCode: string, path?: Array<string | number> | string): any;
486 /**
487 * @description
488 * Reports whether the control with the given path has the error specified.
489 *
490 * @param errorCode The code of the error to check
491 * @param path A list of control names that designates how to move from the current control
492 * to the control that should be queried for errors.
493 *
494 * @usageNotes
495 * For example, for the following `FormGroup`:
496 *
497 * ```
498 * form = new FormGroup({
499 * address: new FormGroup({ street: new FormControl() })
500 * });
501 * ```
502 *
503 * The path to the 'street' control from the root form would be 'address' -> 'street'.
504 *
505 * It can be provided to this method in one of two formats:
506 *
507 * 1. An array of string control names, e.g. `['address', 'street']`
508 * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
509 *
510 * If no path is given, this method checks for the error on the current control.
511 *
512 * @returns whether the given error is present in the control at the given path.
513 *
514 * If the control is not present, false is returned.
515 */
516 hasError(errorCode: string, path?: Array<string | number> | string): boolean;
517 /**
518 * Retrieves the top-level ancestor of this control.
519 */
520 get root(): AbstractControl;
521 private _calculateStatus;
522}
523
524/**
525 * @description
526 * Base class for control directives.
527 *
528 * This class is only used internally in the `ReactiveFormsModule` and the `FormsModule`.
529 *
530 * @publicApi
531 */
532export declare abstract class AbstractControlDirective {
533 /**
534 * @description
535 * A reference to the underlying control.
536 *
537 * @returns the control that backs this directive. Most properties fall through to that instance.
538 */
539 abstract get control(): AbstractControl | null;
540 /**
541 * @description
542 * Reports the value of the control if it is present, otherwise null.
543 */
544 get value(): any;
545 /**
546 * @description
547 * Reports whether the control is valid. A control is considered valid if no
548 * validation errors exist with the current value.
549 * If the control is not present, null is returned.
550 */
551 get valid(): boolean | null;
552 /**
553 * @description
554 * Reports whether the control is invalid, meaning that an error exists in the input value.
555 * If the control is not present, null is returned.
556 */
557 get invalid(): boolean | null;
558 /**
559 * @description
560 * Reports whether a control is pending, meaning that that async validation is occurring and
561 * errors are not yet available for the input value. If the control is not present, null is
562 * returned.
563 */
564 get pending(): boolean | null;
565 /**
566 * @description
567 * Reports whether the control is disabled, meaning that the control is disabled
568 * in the UI and is exempt from validation checks and excluded from aggregate
569 * values of ancestor controls. If the control is not present, null is returned.
570 */
571 get disabled(): boolean | null;
572 /**
573 * @description
574 * Reports whether the control is enabled, meaning that the control is included in ancestor
575 * calculations of validity or value. If the control is not present, null is returned.
576 */
577 get enabled(): boolean | null;
578 /**
579 * @description
580 * Reports the control's validation errors. If the control is not present, null is returned.
581 */
582 get errors(): ValidationErrors | null;
583 /**
584 * @description
585 * Reports whether the control is pristine, meaning that the user has not yet changed
586 * the value in the UI. If the control is not present, null is returned.
587 */
588 get pristine(): boolean | null;
589 /**
590 * @description
591 * Reports whether the control is dirty, meaning that the user has changed
592 * the value in the UI. If the control is not present, null is returned.
593 */
594 get dirty(): boolean | null;
595 /**
596 * @description
597 * Reports whether the control is touched, meaning that the user has triggered
598 * a `blur` event on it. If the control is not present, null is returned.
599 */
600 get touched(): boolean | null;
601 /**
602 * @description
603 * Reports the validation status of the control. Possible values include:
604 * 'VALID', 'INVALID', 'DISABLED', and 'PENDING'.
605 * If the control is not present, null is returned.
606 */
607 get status(): string | null;
608 /**
609 * @description
610 * Reports whether the control is untouched, meaning that the user has not yet triggered
611 * a `blur` event on it. If the control is not present, null is returned.
612 */
613 get untouched(): boolean | null;
614 /**
615 * @description
616 * Returns a multicasting observable that emits a validation status whenever it is
617 * calculated for the control. If the control is not present, null is returned.
618 */
619 get statusChanges(): Observable<any> | null;
620 /**
621 * @description
622 * Returns a multicasting observable of value changes for the control that emits every time the
623 * value of the control changes in the UI or programmatically.
624 * If the control is not present, null is returned.
625 */
626 get valueChanges(): Observable<any> | null;
627 /**
628 * @description
629 * Returns an array that represents the path from the top-level form to this control.
630 * Each index is the string name of the control on that level.
631 */
632 get path(): string[] | null;
633 /**
634 * Contains the result of merging synchronous validators into a single validator function
635 * (combined using `Validators.compose`).
636 */
637 private _composedValidatorFn;
638 /**
639 * Contains the result of merging asynchronous validators into a single validator function
640 * (combined using `Validators.composeAsync`).
641 */
642 private _composedAsyncValidatorFn;
643 /**
644 * @description
645 * Synchronous validator function composed of all the synchronous validators registered with this
646 * directive.
647 */
648 get validator(): ValidatorFn | null;
649 /**
650 * @description
651 * Asynchronous validator function composed of all the asynchronous validators registered with
652 * this directive.
653 */
654 get asyncValidator(): AsyncValidatorFn | null;
655 private _onDestroyCallbacks;
656 /**
657 * @description
658 * Resets the control with the provided value if the control is present.
659 */
660 reset(value?: any): void;
661 /**
662 * @description
663 * Reports whether the control with the given path has the error specified.
664 *
665 * @param errorCode The code of the error to check
666 * @param path A list of control names that designates how to move from the current control
667 * to the control that should be queried for errors.
668 *
669 * @usageNotes
670 * For example, for the following `FormGroup`:
671 *
672 * ```
673 * form = new FormGroup({
674 * address: new FormGroup({ street: new FormControl() })
675 * });
676 * ```
677 *
678 * The path to the 'street' control from the root form would be 'address' -> 'street'.
679 *
680 * It can be provided to this method in one of two formats:
681 *
682 * 1. An array of string control names, e.g. `['address', 'street']`
683 * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
684 *
685 * If no path is given, this method checks for the error on the current control.
686 *
687 * @returns whether the given error is present in the control at the given path.
688 *
689 * If the control is not present, false is returned.
690 */
691 hasError(errorCode: string, path?: Array<string | number> | string): boolean;
692 /**
693 * @description
694 * Reports error data for the control with the given path.
695 *
696 * @param errorCode The code of the error to check
697 * @param path A list of control names that designates how to move from the current control
698 * to the control that should be queried for errors.
699 *
700 * @usageNotes
701 * For example, for the following `FormGroup`:
702 *
703 * ```
704 * form = new FormGroup({
705 * address: new FormGroup({ street: new FormControl() })
706 * });
707 * ```
708 *
709 * The path to the 'street' control from the root form would be 'address' -> 'street'.
710 *
711 * It can be provided to this method in one of two formats:
712 *
713 * 1. An array of string control names, e.g. `['address', 'street']`
714 * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
715 *
716 * @returns error data for that particular error. If the control or error is not present,
717 * null is returned.
718 */
719 getError(errorCode: string, path?: Array<string | number> | string): any;
720}
721
722/**
723 * Interface for options provided to an `AbstractControl`.
724 *
725 * @publicApi
726 */
727export declare interface AbstractControlOptions {
728 /**
729 * @description
730 * The list of validators applied to a control.
731 */
732 validators?: ValidatorFn | ValidatorFn[] | null;
733 /**
734 * @description
735 * The list of async validators applied to control.
736 */
737 asyncValidators?: AsyncValidatorFn | AsyncValidatorFn[] | null;
738 /**
739 * @description
740 * The event name for control to update upon.
741 */
742 updateOn?: 'change' | 'blur' | 'submit';
743}
744
745/**
746 * @description
747 * A base class for code shared between the `NgModelGroup` and `FormGroupName` directives.
748 *
749 * @publicApi
750 */
751export declare class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy {
752 /** @nodoc */
753 ngOnInit(): void;
754 /** @nodoc */
755 ngOnDestroy(): void;
756 /**
757 * @description
758 * The `FormGroup` bound to this directive.
759 */
760 get control(): FormGroup;
761 /**
762 * @description
763 * The path to this group from the top-level directive.
764 */
765 get path(): string[];
766 /**
767 * @description
768 * The top-level directive for this group if present, otherwise null.
769 */
770 get formDirective(): Form | null;
771}
772
773/**
774 * A base class for Validator-based Directives. The class contains common logic shared across such
775 * Directives.
776 *
777 * For internal use only, this class is not intended for use outside of the Forms package.
778 */
779declare abstract class AbstractValidatorDirective implements Validator {
780 private _validator;
781 private _onChange;
782 /**
783 * Helper function invoked from child classes to process changes (from `ngOnChanges` hook).
784 * @nodoc
785 */
786 handleChanges(changes: SimpleChanges): void;
787 /** @nodoc */
788 validate(control: AbstractControl): ValidationErrors | null;
789 /** @nodoc */
790 registerOnValidatorChange(fn: () => void): void;
791}
792
793declare type AnyControlStatus = 'untouched' | 'touched' | 'pristine' | 'dirty' | 'valid' | 'invalid' | 'pending';
794
795/**
796 * @description
797 * An interface implemented by classes that perform asynchronous validation.
798 *
799 * @usageNotes
800 *
801 * ### Provide a custom async validator directive
802 *
803 * The following example implements the `AsyncValidator` interface to create an
804 * async validator directive with a custom error key.
805 *
806 * ```typescript
807 * import { of } from 'rxjs';
808 *
809 * @Directive({
810 * selector: '[customAsyncValidator]',
811 * providers: [{provide: NG_ASYNC_VALIDATORS, useExisting: CustomAsyncValidatorDirective, multi:
812 * true}]
813 * })
814 * class CustomAsyncValidatorDirective implements AsyncValidator {
815 * validate(control: AbstractControl): Observable<ValidationErrors|null> {
816 * return of({'custom': true});
817 * }
818 * }
819 * ```
820 *
821 * @publicApi
822 */
823export declare interface AsyncValidator extends Validator {
824 /**
825 * @description
826 * Method that performs async validation against the provided control.
827 *
828 * @param control The control to validate against.
829 *
830 * @returns A promise or observable that resolves a map of validation errors
831 * if validation fails, otherwise null.
832 */
833 validate(control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null>;
834}
835
836/**
837 * @description
838 * A function that receives a control and returns a Promise or observable
839 * that emits validation errors if present, otherwise null.
840 *
841 * @publicApi
842 */
843export declare interface AsyncValidatorFn {
844 (control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null>;
845}
846
847/**
848 * @description
849 * A `ControlValueAccessor` for writing a value and listening to changes on a checkbox input
850 * element.
851 *
852 * @usageNotes
853 *
854 * ### Using a checkbox with a reactive form.
855 *
856 * The following example shows how to use a checkbox with a reactive form.
857 *
858 * ```ts
859 * const rememberLoginControl = new FormControl();
860 * ```
861 *
862 * ```
863 * <input type="checkbox" [formControl]="rememberLoginControl">
864 * ```
865 *
866 * @ngModule ReactiveFormsModule
867 * @ngModule FormsModule
868 * @publicApi
869 */
870export declare class CheckboxControlValueAccessor extends ɵangular_packages_forms_forms_g implements ControlValueAccessor {
871 /**
872 * Sets the "checked" property on the input element.
873 * @nodoc
874 */
875 writeValue(value: any): void;
876}
877
878/**
879 * A Directive that adds the `required` validator to checkbox controls marked with the
880 * `required` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list.
881 *
882 * @see [Form Validation](guide/form-validation)
883 *
884 * @usageNotes
885 *
886 * ### Adding a required checkbox validator using template-driven forms
887 *
888 * The following example shows how to add a checkbox required validator to an input attached to an
889 * ngModel binding.
890 *
891 * ```
892 * <input type="checkbox" name="active" ngModel required>
893 * ```
894 *
895 * @publicApi
896 * @ngModule FormsModule
897 * @ngModule ReactiveFormsModule
898 */
899export declare class CheckboxRequiredValidator extends RequiredValidator {
900 /**
901 * Method that validates whether or not the checkbox has been checked.
902 * Returns the validation result if enabled, otherwise null.
903 * @nodoc
904 */
905 validate(control: AbstractControl): ValidationErrors | null;
906}
907
908/**
909 * @description
910 * Provide this token to control if form directives buffer IME input until
911 * the "compositionend" event occurs.
912 * @publicApi
913 */
914export declare const COMPOSITION_BUFFER_MODE: InjectionToken<boolean>;
915
916/**
917 * @description
918 * A base class for directives that contain multiple registered instances of `NgControl`.
919 * Only used by the forms module.
920 *
921 * @publicApi
922 */
923export declare abstract class ControlContainer extends AbstractControlDirective {
924 /**
925 * @description
926 * The name for the control
927 */
928 name: string | number | null;
929 /**
930 * @description
931 * The top-level form directive for the control.
932 */
933 get formDirective(): Form | null;
934 /**
935 * @description
936 * The path to this group.
937 */
938 get path(): string[] | null;
939}
940
941/**
942 * @description
943 * Defines an interface that acts as a bridge between the Angular forms API and a
944 * native element in the DOM.
945 *
946 * Implement this interface to create a custom form control directive
947 * that integrates with Angular forms.
948 *
949 * @see DefaultValueAccessor
950 *
951 * @publicApi
952 */
953export declare interface ControlValueAccessor {
954 /**
955 * @description
956 * Writes a new value to the element.
957 *
958 * This method is called by the forms API to write to the view when programmatic
959 * changes from model to view are requested.
960 *
961 * @usageNotes
962 * ### Write a value to the element
963 *
964 * The following example writes a value to the native DOM element.
965 *
966 * ```ts
967 * writeValue(value: any): void {
968 * this._renderer.setProperty(this._elementRef.nativeElement, 'value', value);
969 * }
970 * ```
971 *
972 * @param obj The new value for the element
973 */
974 writeValue(obj: any): void;
975 /**
976 * @description
977 * Registers a callback function that is called when the control's value
978 * changes in the UI.
979 *
980 * This method is called by the forms API on initialization to update the form
981 * model when values propagate from the view to the model.
982 *
983 * When implementing the `registerOnChange` method in your own value accessor,
984 * save the given function so your class calls it at the appropriate time.
985 *
986 * @usageNotes
987 * ### Store the change function
988 *
989 * The following example stores the provided function as an internal method.
990 *
991 * ```ts
992 * registerOnChange(fn: (_: any) => void): void {
993 * this._onChange = fn;
994 * }
995 * ```
996 *
997 * When the value changes in the UI, call the registered
998 * function to allow the forms API to update itself:
999 *
1000 * ```ts
1001 * host: {
1002 * '(change)': '_onChange($event.target.value)'
1003 * }
1004 * ```
1005 *
1006 * @param fn The callback function to register
1007 */
1008 registerOnChange(fn: any): void;
1009 /**
1010 * @description
1011 * Registers a callback function that is called by the forms API on initialization
1012 * to update the form model on blur.
1013 *
1014 * When implementing `registerOnTouched` in your own value accessor, save the given
1015 * function so your class calls it when the control should be considered
1016 * blurred or "touched".
1017 *
1018 * @usageNotes
1019 * ### Store the callback function
1020 *
1021 * The following example stores the provided function as an internal method.
1022 *
1023 * ```ts
1024 * registerOnTouched(fn: any): void {
1025 * this._onTouched = fn;
1026 * }
1027 * ```
1028 *
1029 * On blur (or equivalent), your class should call the registered function to allow
1030 * the forms API to update itself:
1031 *
1032 * ```ts
1033 * host: {
1034 * '(blur)': '_onTouched()'
1035 * }
1036 * ```
1037 *
1038 * @param fn The callback function to register
1039 */
1040 registerOnTouched(fn: any): void;
1041 /**
1042 * @description
1043 * Function that is called by the forms API when the control status changes to
1044 * or from 'DISABLED'. Depending on the status, it enables or disables the
1045 * appropriate DOM element.
1046 *
1047 * @usageNotes
1048 * The following is an example of writing the disabled property to a native DOM element:
1049 *
1050 * ```ts
1051 * setDisabledState(isDisabled: boolean): void {
1052 * this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
1053 * }
1054 * ```
1055 *
1056 * @param isDisabled The disabled status to set on the element
1057 */
1058 setDisabledState?(isDisabled: boolean): void;
1059}
1060
1061/**
1062 * The default `ControlValueAccessor` for writing a value and listening to changes on input
1063 * elements. The accessor is used by the `FormControlDirective`, `FormControlName`, and
1064 * `NgModel` directives.
1065 *
1066 * {@searchKeywords ngDefaultControl}
1067 *
1068 * @usageNotes
1069 *
1070 * ### Using the default value accessor
1071 *
1072 * The following example shows how to use an input element that activates the default value accessor
1073 * (in this case, a text field).
1074 *
1075 * ```ts
1076 * const firstNameControl = new FormControl();
1077 * ```
1078 *
1079 * ```
1080 * <input type="text" [formControl]="firstNameControl">
1081 * ```
1082 *
1083 * This value accessor is used by default for `<input type="text">` and `<textarea>` elements, but
1084 * you could also use it for custom components that have similar behavior and do not require special
1085 * processing. In order to attach the default value accessor to a custom element, add the
1086 * `ngDefaultControl` attribute as shown below.
1087 *
1088 * ```
1089 * <custom-input-component ngDefaultControl [(ngModel)]="value"></custom-input-component>
1090 * ```
1091 *
1092 * @ngModule ReactiveFormsModule
1093 * @ngModule FormsModule
1094 * @publicApi
1095 */
1096export declare class DefaultValueAccessor extends ɵangular_packages_forms_forms_f implements ControlValueAccessor {
1097 private _compositionMode;
1098 /** Whether the user is creating a composition string (IME events). */
1099 private _composing;
1100 constructor(renderer: Renderer2, elementRef: ElementRef, _compositionMode: boolean);
1101 /**
1102 * Sets the "value" property on the input element.
1103 * @nodoc
1104 */
1105 writeValue(value: any): void;
1106}
1107
1108/**
1109 * A directive that adds the `email` validator to controls marked with the
1110 * `email` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list.
1111 *
1112 * @see [Form Validation](guide/form-validation)
1113 *
1114 * @usageNotes
1115 *
1116 * ### Adding an email validator
1117 *
1118 * The following example shows how to add an email validator to an input attached to an ngModel
1119 * binding.
1120 *
1121 * ```
1122 * <input type="email" name="email" ngModel email>
1123 * <input type="email" name="email" ngModel email="true">
1124 * <input type="email" name="email" ngModel [email]="true">
1125 * ```
1126 *
1127 * @publicApi
1128 * @ngModule FormsModule
1129 * @ngModule ReactiveFormsModule
1130 */
1131export declare class EmailValidator implements Validator {
1132 private _enabled;
1133 private _onChange?;
1134 /**
1135 * @description
1136 * Tracks changes to the email attribute bound to this directive.
1137 */
1138 set email(value: boolean | string);
1139 /**
1140 * Method that validates whether an email address is valid.
1141 * Returns the validation result if enabled, otherwise null.
1142 * @nodoc
1143 */
1144 validate(control: AbstractControl): ValidationErrors | null;
1145 /**
1146 * Registers a callback function to call when the validator inputs change.
1147 * @nodoc
1148 */
1149 registerOnValidatorChange(fn: () => void): void;
1150}
1151
1152/**
1153 * @description
1154 * An interface implemented by `FormGroupDirective` and `NgForm` directives.
1155 *
1156 * Only used by the `ReactiveFormsModule` and `FormsModule`.
1157 *
1158 * @publicApi
1159 */
1160export declare interface Form {
1161 /**
1162 * @description
1163 * Add a control to this form.
1164 *
1165 * @param dir The control directive to add to the form.
1166 */
1167 addControl(dir: NgControl): void;
1168 /**
1169 * @description
1170 * Remove a control from this form.
1171 *
1172 * @param dir: The control directive to remove from the form.
1173 */
1174 removeControl(dir: NgControl): void;
1175 /**
1176 * @description
1177 * The control directive from which to get the `FormControl`.
1178 *
1179 * @param dir: The control directive.
1180 */
1181 getControl(dir: NgControl): FormControl;
1182 /**
1183 * @description
1184 * Add a group of controls to this form.
1185 *
1186 * @param dir: The control group directive to add.
1187 */
1188 addFormGroup(dir: AbstractFormGroupDirective): void;
1189 /**
1190 * @description
1191 * Remove a group of controls to this form.
1192 *
1193 * @param dir: The control group directive to remove.
1194 */
1195 removeFormGroup(dir: AbstractFormGroupDirective): void;
1196 /**
1197 * @description
1198 * The `FormGroup` associated with a particular `AbstractFormGroupDirective`.
1199 *
1200 * @param dir: The form group directive from which to get the `FormGroup`.
1201 */
1202 getFormGroup(dir: AbstractFormGroupDirective): FormGroup;
1203 /**
1204 * @description
1205 * Update the model for a particular control with a new value.
1206 *
1207 * @param dir: The control directive to update.
1208 * @param value: The new value for the control.
1209 */
1210 updateModel(dir: NgControl, value: any): void;
1211}
1212
1213/**
1214 * Tracks the value and validity state of an array of `FormControl`,
1215 * `FormGroup` or `FormArray` instances.
1216 *
1217 * A `FormArray` aggregates the values of each child `FormControl` into an array.
1218 * It calculates its status by reducing the status values of its children. For example, if one of
1219 * the controls in a `FormArray` is invalid, the entire array becomes invalid.
1220 *
1221 * `FormArray` is one of the three fundamental building blocks used to define forms in Angular,
1222 * along with `FormControl` and `FormGroup`.
1223 *
1224 * @usageNotes
1225 *
1226 * ### Create an array of form controls
1227 *
1228 * ```
1229 * const arr = new FormArray([
1230 * new FormControl('Nancy', Validators.minLength(2)),
1231 * new FormControl('Drew'),
1232 * ]);
1233 *
1234 * console.log(arr.value); // ['Nancy', 'Drew']
1235 * console.log(arr.status); // 'VALID'
1236 * ```
1237 *
1238 * ### Create a form array with array-level validators
1239 *
1240 * You include array-level validators and async validators. These come in handy
1241 * when you want to perform validation that considers the value of more than one child
1242 * control.
1243 *
1244 * The two types of validators are passed in separately as the second and third arg
1245 * respectively, or together as part of an options object.
1246 *
1247 * ```
1248 * const arr = new FormArray([
1249 * new FormControl('Nancy'),
1250 * new FormControl('Drew')
1251 * ], {validators: myValidator, asyncValidators: myAsyncValidator});
1252 * ```
1253 *
1254 * ### Set the updateOn property for all controls in a form array
1255 *
1256 * The options object is used to set a default value for each child
1257 * control's `updateOn` property. If you set `updateOn` to `'blur'` at the
1258 * array level, all child controls default to 'blur', unless the child
1259 * has explicitly specified a different `updateOn` value.
1260 *
1261 * ```ts
1262 * const arr = new FormArray([
1263 * new FormControl()
1264 * ], {updateOn: 'blur'});
1265 * ```
1266 *
1267 * ### Adding or removing controls from a form array
1268 *
1269 * To change the controls in the array, use the `push`, `insert`, `removeAt` or `clear` methods
1270 * in `FormArray` itself. These methods ensure the controls are properly tracked in the
1271 * form's hierarchy. Do not modify the array of `AbstractControl`s used to instantiate
1272 * the `FormArray` directly, as that result in strange and unexpected behavior such
1273 * as broken change detection.
1274 *
1275 * @publicApi
1276 */
1277export declare class FormArray extends AbstractControl {
1278 controls: AbstractControl[];
1279 /**
1280 * Creates a new `FormArray` instance.
1281 *
1282 * @param controls An array of child controls. Each child control is given an index
1283 * where it is registered.
1284 *
1285 * @param validatorOrOpts A synchronous validator function, or an array of
1286 * such functions, or an `AbstractControlOptions` object that contains validation functions
1287 * and a validation trigger.
1288 *
1289 * @param asyncValidator A single async validator or array of async validator functions
1290 *
1291 */
1292 constructor(controls: AbstractControl[], validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null);
1293 /**
1294 * Get the `AbstractControl` at the given `index` in the array.
1295 *
1296 * @param index Index in the array to retrieve the control
1297 */
1298 at(index: number): AbstractControl;
1299 /**
1300 * Insert a new `AbstractControl` at the end of the array.
1301 *
1302 * @param control Form control to be inserted
1303 * @param options Specifies whether this FormArray instance should emit events after a new
1304 * control is added.
1305 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1306 * `valueChanges` observables emit events with the latest status and value when the control is
1307 * inserted. When false, no events are emitted.
1308 */
1309 push(control: AbstractControl, options?: {
1310 emitEvent?: boolean;
1311 }): void;
1312 /**
1313 * Insert a new `AbstractControl` at the given `index` in the array.
1314 *
1315 * @param index Index in the array to insert the control
1316 * @param control Form control to be inserted
1317 * @param options Specifies whether this FormArray instance should emit events after a new
1318 * control is inserted.
1319 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1320 * `valueChanges` observables emit events with the latest status and value when the control is
1321 * inserted. When false, no events are emitted.
1322 */
1323 insert(index: number, control: AbstractControl, options?: {
1324 emitEvent?: boolean;
1325 }): void;
1326 /**
1327 * Remove the control at the given `index` in the array.
1328 *
1329 * @param index Index in the array to remove the control
1330 * @param options Specifies whether this FormArray instance should emit events after a
1331 * control is removed.
1332 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1333 * `valueChanges` observables emit events with the latest status and value when the control is
1334 * removed. When false, no events are emitted.
1335 */
1336 removeAt(index: number, options?: {
1337 emitEvent?: boolean;
1338 }): void;
1339 /**
1340 * Replace an existing control.
1341 *
1342 * @param index Index in the array to replace the control
1343 * @param control The `AbstractControl` control to replace the existing control
1344 * @param options Specifies whether this FormArray instance should emit events after an
1345 * existing control is replaced with a new one.
1346 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1347 * `valueChanges` observables emit events with the latest status and value when the control is
1348 * replaced with a new one. When false, no events are emitted.
1349 */
1350 setControl(index: number, control: AbstractControl, options?: {
1351 emitEvent?: boolean;
1352 }): void;
1353 /**
1354 * Length of the control array.
1355 */
1356 get length(): number;
1357 /**
1358 * Sets the value of the `FormArray`. It accepts an array that matches
1359 * the structure of the control.
1360 *
1361 * This method performs strict checks, and throws an error if you try
1362 * to set the value of a control that doesn't exist or if you exclude the
1363 * value of a control.
1364 *
1365 * @usageNotes
1366 * ### Set the values for the controls in the form array
1367 *
1368 * ```
1369 * const arr = new FormArray([
1370 * new FormControl(),
1371 * new FormControl()
1372 * ]);
1373 * console.log(arr.value); // [null, null]
1374 *
1375 * arr.setValue(['Nancy', 'Drew']);
1376 * console.log(arr.value); // ['Nancy', 'Drew']
1377 * ```
1378 *
1379 * @param value Array of values for the controls
1380 * @param options Configure options that determine how the control propagates changes and
1381 * emits events after the value changes
1382 *
1383 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
1384 * is false.
1385 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1386 * `valueChanges`
1387 * observables emit events with the latest status and value when the control value is updated.
1388 * When false, no events are emitted.
1389 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
1390 * updateValueAndValidity} method.
1391 */
1392 setValue(value: any[], options?: {
1393 onlySelf?: boolean;
1394 emitEvent?: boolean;
1395 }): void;
1396 /**
1397 * Patches the value of the `FormArray`. It accepts an array that matches the
1398 * structure of the control, and does its best to match the values to the correct
1399 * controls in the group.
1400 *
1401 * It accepts both super-sets and sub-sets of the array without throwing an error.
1402 *
1403 * @usageNotes
1404 * ### Patch the values for controls in a form array
1405 *
1406 * ```
1407 * const arr = new FormArray([
1408 * new FormControl(),
1409 * new FormControl()
1410 * ]);
1411 * console.log(arr.value); // [null, null]
1412 *
1413 * arr.patchValue(['Nancy']);
1414 * console.log(arr.value); // ['Nancy', null]
1415 * ```
1416 *
1417 * @param value Array of latest values for the controls
1418 * @param options Configure options that determine how the control propagates changes and
1419 * emits events after the value changes
1420 *
1421 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
1422 * is false.
1423 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1424 * `valueChanges` observables emit events with the latest status and value when the control value
1425 * is updated. When false, no events are emitted. The configuration options are passed to
1426 * the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
1427 */
1428 patchValue(value: any[], options?: {
1429 onlySelf?: boolean;
1430 emitEvent?: boolean;
1431 }): void;
1432 /**
1433 * Resets the `FormArray` and all descendants are marked `pristine` and `untouched`, and the
1434 * value of all descendants to null or null maps.
1435 *
1436 * You reset to a specific form state by passing in an array of states
1437 * that matches the structure of the control. The state is a standalone value
1438 * or a form state object with both a value and a disabled status.
1439 *
1440 * @usageNotes
1441 * ### Reset the values in a form array
1442 *
1443 * ```ts
1444 * const arr = new FormArray([
1445 * new FormControl(),
1446 * new FormControl()
1447 * ]);
1448 * arr.reset(['name', 'last name']);
1449 *
1450 * console.log(this.arr.value); // ['name', 'last name']
1451 * ```
1452 *
1453 * ### Reset the values in a form array and the disabled status for the first control
1454 *
1455 * ```
1456 * this.arr.reset([
1457 * {value: 'name', disabled: true},
1458 * 'last'
1459 * ]);
1460 *
1461 * console.log(this.arr.value); // ['name', 'last name']
1462 * console.log(this.arr.get(0).status); // 'DISABLED'
1463 * ```
1464 *
1465 * @param value Array of values for the controls
1466 * @param options Configure options that determine how the control propagates changes and
1467 * emits events after the value changes
1468 *
1469 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
1470 * is false.
1471 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1472 * `valueChanges`
1473 * observables emit events with the latest status and value when the control is reset.
1474 * When false, no events are emitted.
1475 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
1476 * updateValueAndValidity} method.
1477 */
1478 reset(value?: any, options?: {
1479 onlySelf?: boolean;
1480 emitEvent?: boolean;
1481 }): void;
1482 /**
1483 * The aggregate value of the array, including any disabled controls.
1484 *
1485 * Reports all values regardless of disabled status.
1486 * For enabled controls only, the `value` property is the best way to get the value of the array.
1487 */
1488 getRawValue(): any[];
1489 /**
1490 * Remove all controls in the `FormArray`.
1491 *
1492 * @param options Specifies whether this FormArray instance should emit events after all
1493 * controls are removed.
1494 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1495 * `valueChanges` observables emit events with the latest status and value when all controls
1496 * in this FormArray instance are removed. When false, no events are emitted.
1497 *
1498 * @usageNotes
1499 * ### Remove all elements from a FormArray
1500 *
1501 * ```ts
1502 * const arr = new FormArray([
1503 * new FormControl(),
1504 * new FormControl()
1505 * ]);
1506 * console.log(arr.length); // 2
1507 *
1508 * arr.clear();
1509 * console.log(arr.length); // 0
1510 * ```
1511 *
1512 * It's a simpler and more efficient alternative to removing all elements one by one:
1513 *
1514 * ```ts
1515 * const arr = new FormArray([
1516 * new FormControl(),
1517 * new FormControl()
1518 * ]);
1519 *
1520 * while (arr.length) {
1521 * arr.removeAt(0);
1522 * }
1523 * ```
1524 */
1525 clear(options?: {
1526 emitEvent?: boolean;
1527 }): void;
1528 private _registerControl;
1529}
1530
1531/**
1532 * @description
1533 *
1534 * Syncs a nested `FormArray` to a DOM element.
1535 *
1536 * This directive is designed to be used with a parent `FormGroupDirective` (selector:
1537 * `[formGroup]`).
1538 *
1539 * It accepts the string name of the nested `FormArray` you want to link, and
1540 * will look for a `FormArray` registered with that name in the parent
1541 * `FormGroup` instance you passed into `FormGroupDirective`.
1542 *
1543 * @see [Reactive Forms Guide](guide/reactive-forms)
1544 * @see `AbstractControl`
1545 *
1546 * @usageNotes
1547 *
1548 * ### Example
1549 *
1550 * {@example forms/ts/nestedFormArray/nested_form_array_example.ts region='Component'}
1551 *
1552 * @ngModule ReactiveFormsModule
1553 * @publicApi
1554 */
1555export declare class FormArrayName extends ControlContainer implements OnInit, OnDestroy {
1556 /**
1557 * @description
1558 * Tracks the name of the `FormArray` bound to the directive. The name corresponds
1559 * to a key in the parent `FormGroup` or `FormArray`.
1560 * Accepts a name as a string or a number.
1561 * The name in the form of a string is useful for individual forms,
1562 * while the numerical form allows for form arrays to be bound
1563 * to indices when iterating over arrays in a `FormArray`.
1564 */
1565 name: string | number | null;
1566 constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
1567 /**
1568 * A lifecycle method called when the directive's inputs are initialized. For internal use only.
1569 * @throws If the directive does not have a valid parent.
1570 * @nodoc
1571 */
1572 ngOnInit(): void;
1573 /**
1574 * A lifecycle method called before the directive's instance is destroyed. For internal use only.
1575 * @nodoc
1576 */
1577 ngOnDestroy(): void;
1578 /**
1579 * @description
1580 * The `FormArray` bound to this directive.
1581 */
1582 get control(): FormArray;
1583 /**
1584 * @description
1585 * The top-level directive for this group if present, otherwise null.
1586 */
1587 get formDirective(): FormGroupDirective | null;
1588 /**
1589 * @description
1590 * Returns an array that represents the path from the top-level form to this control.
1591 * Each index is the string name of the control on that level.
1592 */
1593 get path(): string[];
1594 private _checkParentType;
1595}
1596
1597/**
1598 * @description
1599 * Creates an `AbstractControl` from a user-specified configuration.
1600 *
1601 * The `FormBuilder` provides syntactic sugar that shortens creating instances of a `FormControl`,
1602 * `FormGroup`, or `FormArray`. It reduces the amount of boilerplate needed to build complex
1603 * forms.
1604 *
1605 * @see [Reactive Forms Guide](/guide/reactive-forms)
1606 *
1607 * @publicApi
1608 */
1609export declare class FormBuilder {
1610 /**
1611 * @description
1612 * Construct a new `FormGroup` instance.
1613 *
1614 * @param controlsConfig A collection of child controls. The key for each child is the name
1615 * under which it is registered.
1616 *
1617 * @param options Configuration options object for the `FormGroup`. The object should have the
1618 * the `AbstractControlOptions` type and might contain the following fields:
1619 * * `validators`: A synchronous validator function, or an array of validator functions
1620 * * `asyncValidators`: A single async validator or array of async validator functions
1621 * * `updateOn`: The event upon which the control should be updated (options: 'change' | 'blur' |
1622 * submit')
1623 */
1624 group(controlsConfig: {
1625 [key: string]: any;
1626 }, options?: AbstractControlOptions | null): FormGroup;
1627 /**
1628 * @description
1629 * Construct a new `FormGroup` instance.
1630 *
1631 * @deprecated This API is not typesafe and can result in issues with Closure Compiler renaming.
1632 * Use the `FormBuilder#group` overload with `AbstractControlOptions` instead.
1633 * Note that `AbstractControlOptions` expects `validators` and `asyncValidators` to be valid
1634 * validators. If you have custom validators, make sure their validation function parameter is
1635 * `AbstractControl` and not a sub-class, such as `FormGroup`. These functions will be called with
1636 * an object of type `AbstractControl` and that cannot be automatically downcast to a subclass, so
1637 * TypeScript sees this as an error. For example, change the `(group: FormGroup) =>
1638 * ValidationErrors|null` signature to be `(group: AbstractControl) => ValidationErrors|null`.
1639 *
1640 * @param controlsConfig A collection of child controls. The key for each child is the name
1641 * under which it is registered.
1642 *
1643 * @param options Configuration options object for the `FormGroup`. The legacy configuration
1644 * object consists of:
1645 * * `validator`: A synchronous validator function, or an array of validator functions
1646 * * `asyncValidator`: A single async validator or array of async validator functions
1647 * Note: the legacy format is deprecated and might be removed in one of the next major versions
1648 * of Angular.
1649 */
1650 group(controlsConfig: {
1651 [key: string]: any;
1652 }, options: {
1653 [key: string]: any;
1654 }): FormGroup;
1655 /**
1656 * @description
1657 * Construct a new `FormControl` with the given state, validators and options.
1658 *
1659 * @param formState Initializes the control with an initial state value, or
1660 * with an object that contains both a value and a disabled status.
1661 *
1662 * @param validatorOrOpts A synchronous validator function, or an array of
1663 * such functions, or an `AbstractControlOptions` object that contains
1664 * validation functions and a validation trigger.
1665 *
1666 * @param asyncValidator A single async validator or array of async validator
1667 * functions.
1668 *
1669 * @usageNotes
1670 *
1671 * ### Initialize a control as disabled
1672 *
1673 * The following example returns a control with an initial value in a disabled state.
1674 *
1675 * <code-example path="forms/ts/formBuilder/form_builder_example.ts" region="disabled-control">
1676 * </code-example>
1677 */
1678 control(formState: any, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): FormControl;
1679 /**
1680 * Constructs a new `FormArray` from the given array of configurations,
1681 * validators and options.
1682 *
1683 * @param controlsConfig An array of child controls or control configs. Each
1684 * child control is given an index when it is registered.
1685 *
1686 * @param validatorOrOpts A synchronous validator function, or an array of
1687 * such functions, or an `AbstractControlOptions` object that contains
1688 * validation functions and a validation trigger.
1689 *
1690 * @param asyncValidator A single async validator or array of async validator
1691 * functions.
1692 */
1693 array(controlsConfig: any[], validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): FormArray;
1694}
1695
1696/**
1697 * Tracks the value and validation status of an individual form control.
1698 *
1699 * This is one of the three fundamental building blocks of Angular forms, along with
1700 * `FormGroup` and `FormArray`. It extends the `AbstractControl` class that
1701 * implements most of the base functionality for accessing the value, validation status,
1702 * user interactions and events. See [usage examples below](#usage-notes).
1703 *
1704 * @see `AbstractControl`
1705 * @see [Reactive Forms Guide](guide/reactive-forms)
1706 * @see [Usage Notes](#usage-notes)
1707 *
1708 * @usageNotes
1709 *
1710 * ### Initializing Form Controls
1711 *
1712 * Instantiate a `FormControl`, with an initial value.
1713 *
1714 * ```ts
1715 * const control = new FormControl('some value');
1716 * console.log(control.value); // 'some value'
1717 *```
1718 *
1719 * The following example initializes the control with a form state object. The `value`
1720 * and `disabled` keys are required in this case.
1721 *
1722 * ```ts
1723 * const control = new FormControl({ value: 'n/a', disabled: true });
1724 * console.log(control.value); // 'n/a'
1725 * console.log(control.status); // 'DISABLED'
1726 * ```
1727 *
1728 * The following example initializes the control with a sync validator.
1729 *
1730 * ```ts
1731 * const control = new FormControl('', Validators.required);
1732 * console.log(control.value); // ''
1733 * console.log(control.status); // 'INVALID'
1734 * ```
1735 *
1736 * The following example initializes the control using an options object.
1737 *
1738 * ```ts
1739 * const control = new FormControl('', {
1740 * validators: Validators.required,
1741 * asyncValidators: myAsyncValidator
1742 * });
1743 * ```
1744 *
1745 * ### Configure the control to update on a blur event
1746 *
1747 * Set the `updateOn` option to `'blur'` to update on the blur `event`.
1748 *
1749 * ```ts
1750 * const control = new FormControl('', { updateOn: 'blur' });
1751 * ```
1752 *
1753 * ### Configure the control to update on a submit event
1754 *
1755 * Set the `updateOn` option to `'submit'` to update on a submit `event`.
1756 *
1757 * ```ts
1758 * const control = new FormControl('', { updateOn: 'submit' });
1759 * ```
1760 *
1761 * ### Reset the control back to an initial value
1762 *
1763 * You reset to a specific form state by passing through a standalone
1764 * value or a form state object that contains both a value and a disabled state
1765 * (these are the only two properties that cannot be calculated).
1766 *
1767 * ```ts
1768 * const control = new FormControl('Nancy');
1769 *
1770 * console.log(control.value); // 'Nancy'
1771 *
1772 * control.reset('Drew');
1773 *
1774 * console.log(control.value); // 'Drew'
1775 * ```
1776 *
1777 * ### Reset the control back to an initial value and disabled
1778 *
1779 * ```
1780 * const control = new FormControl('Nancy');
1781 *
1782 * console.log(control.value); // 'Nancy'
1783 * console.log(control.status); // 'VALID'
1784 *
1785 * control.reset({ value: 'Drew', disabled: true });
1786 *
1787 * console.log(control.value); // 'Drew'
1788 * console.log(control.status); // 'DISABLED'
1789 * ```
1790 *
1791 * @publicApi
1792 */
1793export declare class FormControl extends AbstractControl {
1794 /**
1795 * Creates a new `FormControl` instance.
1796 *
1797 * @param formState Initializes the control with an initial value,
1798 * or an object that defines the initial value and disabled state.
1799 *
1800 * @param validatorOrOpts A synchronous validator function, or an array of
1801 * such functions, or an `AbstractControlOptions` object that contains validation functions
1802 * and a validation trigger.
1803 *
1804 * @param asyncValidator A single async validator or array of async validator functions
1805 *
1806 */
1807 constructor(formState?: any, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null);
1808 /**
1809 * Sets a new value for the form control.
1810 *
1811 * @param value The new value for the control.
1812 * @param options Configuration options that determine how the control propagates changes
1813 * and emits events when the value changes.
1814 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
1815 * updateValueAndValidity} method.
1816 *
1817 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
1818 * false.
1819 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1820 * `valueChanges`
1821 * observables emit events with the latest status and value when the control value is updated.
1822 * When false, no events are emitted.
1823 * * `emitModelToViewChange`: When true or not supplied (the default), each change triggers an
1824 * `onChange` event to
1825 * update the view.
1826 * * `emitViewToModelChange`: When true or not supplied (the default), each change triggers an
1827 * `ngModelChange`
1828 * event to update the model.
1829 *
1830 */
1831 setValue(value: any, options?: {
1832 onlySelf?: boolean;
1833 emitEvent?: boolean;
1834 emitModelToViewChange?: boolean;
1835 emitViewToModelChange?: boolean;
1836 }): void;
1837 /**
1838 * Patches the value of a control.
1839 *
1840 * This function is functionally the same as {@link FormControl#setValue setValue} at this level.
1841 * It exists for symmetry with {@link FormGroup#patchValue patchValue} on `FormGroups` and
1842 * `FormArrays`, where it does behave differently.
1843 *
1844 * @see `setValue` for options
1845 */
1846 patchValue(value: any, options?: {
1847 onlySelf?: boolean;
1848 emitEvent?: boolean;
1849 emitModelToViewChange?: boolean;
1850 emitViewToModelChange?: boolean;
1851 }): void;
1852 /**
1853 * Resets the form control, marking it `pristine` and `untouched`, and setting
1854 * the value to null.
1855 *
1856 * @param formState Resets the control with an initial value,
1857 * or an object that defines the initial value and disabled state.
1858 *
1859 * @param options Configuration options that determine how the control propagates changes
1860 * and emits events after the value changes.
1861 *
1862 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
1863 * false.
1864 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1865 * `valueChanges`
1866 * observables emit events with the latest status and value when the control is reset.
1867 * When false, no events are emitted.
1868 *
1869 */
1870 reset(formState?: any, options?: {
1871 onlySelf?: boolean;
1872 emitEvent?: boolean;
1873 }): void;
1874 /**
1875 * Register a listener for change events.
1876 *
1877 * @param fn The method that is called when the value changes
1878 */
1879 registerOnChange(fn: Function): void;
1880 /**
1881 * Register a listener for disabled events.
1882 *
1883 * @param fn The method that is called when the disabled status changes.
1884 */
1885 registerOnDisabledChange(fn: (isDisabled: boolean) => void): void;
1886 private _applyFormState;
1887}
1888
1889/**
1890 * @description
1891 * Synchronizes a standalone `FormControl` instance to a form control element.
1892 *
1893 * Note that support for using the `ngModel` input property and `ngModelChange` event with reactive
1894 * form directives was deprecated in Angular v6 and is scheduled for removal in
1895 * a future version of Angular.
1896 * For details, see [Deprecated features](guide/deprecations#ngmodel-with-reactive-forms).
1897 *
1898 * @see [Reactive Forms Guide](guide/reactive-forms)
1899 * @see `FormControl`
1900 * @see `AbstractControl`
1901 *
1902 * @usageNotes
1903 *
1904 * The following example shows how to register a standalone control and set its value.
1905 *
1906 * {@example forms/ts/simpleFormControl/simple_form_control_example.ts region='Component'}
1907 *
1908 * @ngModule ReactiveFormsModule
1909 * @publicApi
1910 */
1911export declare class FormControlDirective extends NgControl implements OnChanges, OnDestroy {
1912 private _ngModelWarningConfig;
1913 /**
1914 * Internal reference to the view model value.
1915 * @nodoc
1916 */
1917 viewModel: any;
1918 /**
1919 * @description
1920 * Tracks the `FormControl` instance bound to the directive.
1921 */
1922 form: FormControl;
1923 /**
1924 * @description
1925 * Triggers a warning in dev mode that this input should not be used with reactive forms.
1926 */
1927 set isDisabled(isDisabled: boolean);
1928 /** @deprecated as of v6 */
1929 model: any;
1930 /** @deprecated as of v6 */
1931 update: EventEmitter<any>;
1932 constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[], _ngModelWarningConfig: string | null);
1933 /** @nodoc */
1934 ngOnChanges(changes: SimpleChanges): void;
1935 /** @nodoc */
1936 ngOnDestroy(): void;
1937 /**
1938 * @description
1939 * Returns an array that represents the path from the top-level form to this control.
1940 * Each index is the string name of the control on that level.
1941 */
1942 get path(): string[];
1943 /**
1944 * @description
1945 * The `FormControl` bound to this directive.
1946 */
1947 get control(): FormControl;
1948 /**
1949 * @description
1950 * Sets the new value for the view model and emits an `ngModelChange` event.
1951 *
1952 * @param newValue The new value for the view model.
1953 */
1954 viewToModelUpdate(newValue: any): void;
1955 private _isControlChanged;
1956}
1957
1958/**
1959 * @description
1960 * Syncs a `FormControl` in an existing `FormGroup` to a form control
1961 * element by name.
1962 *
1963 * @see [Reactive Forms Guide](guide/reactive-forms)
1964 * @see `FormControl`
1965 * @see `AbstractControl`
1966 *
1967 * @usageNotes
1968 *
1969 * ### Register `FormControl` within a group
1970 *
1971 * The following example shows how to register multiple form controls within a form group
1972 * and set their value.
1973 *
1974 * {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
1975 *
1976 * To see `formControlName` examples with different form control types, see:
1977 *
1978 * * Radio buttons: `RadioControlValueAccessor`
1979 * * Selects: `SelectControlValueAccessor`
1980 *
1981 * ### Use with ngModel is deprecated
1982 *
1983 * Support for using the `ngModel` input property and `ngModelChange` event with reactive
1984 * form directives has been deprecated in Angular v6 and is scheduled for removal in
1985 * a future version of Angular.
1986 *
1987 * For details, see [Deprecated features](guide/deprecations#ngmodel-with-reactive-forms).
1988 *
1989 * @ngModule ReactiveFormsModule
1990 * @publicApi
1991 */
1992export declare class FormControlName extends NgControl implements OnChanges, OnDestroy {
1993 private _ngModelWarningConfig;
1994 private _added;
1995 /**
1996 * @description
1997 * Tracks the `FormControl` instance bound to the directive.
1998 */
1999 readonly control: FormControl;
2000 /**
2001 * @description
2002 * Tracks the name of the `FormControl` bound to the directive. The name corresponds
2003 * to a key in the parent `FormGroup` or `FormArray`.
2004 * Accepts a name as a string or a number.
2005 * The name in the form of a string is useful for individual forms,
2006 * while the numerical form allows for form controls to be bound
2007 * to indices when iterating over controls in a `FormArray`.
2008 */
2009 name: string | number | null;
2010 /**
2011 * @description
2012 * Triggers a warning in dev mode that this input should not be used with reactive forms.
2013 */
2014 set isDisabled(isDisabled: boolean);
2015 /** @deprecated as of v6 */
2016 model: any;
2017 /** @deprecated as of v6 */
2018 update: EventEmitter<any>;
2019 constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[], _ngModelWarningConfig: string | null);
2020 /** @nodoc */
2021 ngOnChanges(changes: SimpleChanges): void;
2022 /** @nodoc */
2023 ngOnDestroy(): void;
2024 /**
2025 * @description
2026 * Sets the new value for the view model and emits an `ngModelChange` event.
2027 *
2028 * @param newValue The new value for the view model.
2029 */
2030 viewToModelUpdate(newValue: any): void;
2031 /**
2032 * @description
2033 * Returns an array that represents the path from the top-level form to this control.
2034 * Each index is the string name of the control on that level.
2035 */
2036 get path(): string[];
2037 /**
2038 * @description
2039 * The top-level directive for this group if present, otherwise null.
2040 */
2041 get formDirective(): any;
2042 private _checkParentType;
2043 private _setUpControl;
2044}
2045
2046/**
2047 * Tracks the value and validity state of a group of `FormControl` instances.
2048 *
2049 * A `FormGroup` aggregates the values of each child `FormControl` into one object,
2050 * with each control name as the key. It calculates its status by reducing the status values
2051 * of its children. For example, if one of the controls in a group is invalid, the entire
2052 * group becomes invalid.
2053 *
2054 * `FormGroup` is one of the three fundamental building blocks used to define forms in Angular,
2055 * along with `FormControl` and `FormArray`.
2056 *
2057 * When instantiating a `FormGroup`, pass in a collection of child controls as the first
2058 * argument. The key for each child registers the name for the control.
2059 *
2060 * @usageNotes
2061 *
2062 * ### Create a form group with 2 controls
2063 *
2064 * ```
2065 * const form = new FormGroup({
2066 * first: new FormControl('Nancy', Validators.minLength(2)),
2067 * last: new FormControl('Drew'),
2068 * });
2069 *
2070 * console.log(form.value); // {first: 'Nancy', last; 'Drew'}
2071 * console.log(form.status); // 'VALID'
2072 * ```
2073 *
2074 * ### Create a form group with a group-level validator
2075 *
2076 * You include group-level validators as the second arg, or group-level async
2077 * validators as the third arg. These come in handy when you want to perform validation
2078 * that considers the value of more than one child control.
2079 *
2080 * ```
2081 * const form = new FormGroup({
2082 * password: new FormControl('', Validators.minLength(2)),
2083 * passwordConfirm: new FormControl('', Validators.minLength(2)),
2084 * }, passwordMatchValidator);
2085 *
2086 *
2087 * function passwordMatchValidator(g: FormGroup) {
2088 * return g.get('password').value === g.get('passwordConfirm').value
2089 * ? null : {'mismatch': true};
2090 * }
2091 * ```
2092 *
2093 * Like `FormControl` instances, you choose to pass in
2094 * validators and async validators as part of an options object.
2095 *
2096 * ```
2097 * const form = new FormGroup({
2098 * password: new FormControl('')
2099 * passwordConfirm: new FormControl('')
2100 * }, { validators: passwordMatchValidator, asyncValidators: otherValidator });
2101 * ```
2102 *
2103 * ### Set the updateOn property for all controls in a form group
2104 *
2105 * The options object is used to set a default value for each child
2106 * control's `updateOn` property. If you set `updateOn` to `'blur'` at the
2107 * group level, all child controls default to 'blur', unless the child
2108 * has explicitly specified a different `updateOn` value.
2109 *
2110 * ```ts
2111 * const c = new FormGroup({
2112 * one: new FormControl()
2113 * }, { updateOn: 'blur' });
2114 * ```
2115 *
2116 * @publicApi
2117 */
2118export declare class FormGroup extends AbstractControl {
2119 controls: {
2120 [key: string]: AbstractControl;
2121 };
2122 /**
2123 * Creates a new `FormGroup` instance.
2124 *
2125 * @param controls A collection of child controls. The key for each child is the name
2126 * under which it is registered.
2127 *
2128 * @param validatorOrOpts A synchronous validator function, or an array of
2129 * such functions, or an `AbstractControlOptions` object that contains validation functions
2130 * and a validation trigger.
2131 *
2132 * @param asyncValidator A single async validator or array of async validator functions
2133 *
2134 */
2135 constructor(controls: {
2136 [key: string]: AbstractControl;
2137 }, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null);
2138 /**
2139 * Registers a control with the group's list of controls.
2140 *
2141 * This method does not update the value or validity of the control.
2142 * Use {@link FormGroup#addControl addControl} instead.
2143 *
2144 * @param name The control name to register in the collection
2145 * @param control Provides the control for the given name
2146 */
2147 registerControl(name: string, control: AbstractControl): AbstractControl;
2148 /**
2149 * Add a control to this group.
2150 *
2151 * This method also updates the value and validity of the control.
2152 *
2153 * @param name The control name to add to the collection
2154 * @param control Provides the control for the given name
2155 * @param options Specifies whether this FormGroup instance should emit events after a new
2156 * control is added.
2157 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
2158 * `valueChanges` observables emit events with the latest status and value when the control is
2159 * added. When false, no events are emitted.
2160 */
2161 addControl(name: string, control: AbstractControl, options?: {
2162 emitEvent?: boolean;
2163 }): void;
2164 /**
2165 * Remove a control from this group.
2166 *
2167 * This method also updates the value and validity of the control.
2168 *
2169 * @param name The control name to remove from the collection
2170 * @param options Specifies whether this FormGroup instance should emit events after a
2171 * control is removed.
2172 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
2173 * `valueChanges` observables emit events with the latest status and value when the control is
2174 * removed. When false, no events are emitted.
2175 */
2176 removeControl(name: string, options?: {
2177 emitEvent?: boolean;
2178 }): void;
2179 /**
2180 * Replace an existing control.
2181 *
2182 * @param name The control name to replace in the collection
2183 * @param control Provides the control for the given name
2184 * @param options Specifies whether this FormGroup instance should emit events after an
2185 * existing control is replaced.
2186 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
2187 * `valueChanges` observables emit events with the latest status and value when the control is
2188 * replaced with a new one. When false, no events are emitted.
2189 */
2190 setControl(name: string, control: AbstractControl, options?: {
2191 emitEvent?: boolean;
2192 }): void;
2193 /**
2194 * Check whether there is an enabled control with the given name in the group.
2195 *
2196 * Reports false for disabled controls. If you'd like to check for existence in the group
2197 * only, use {@link AbstractControl#get get} instead.
2198 *
2199 * @param controlName The control name to check for existence in the collection
2200 *
2201 * @returns false for disabled controls, true otherwise.
2202 */
2203 contains(controlName: string): boolean;
2204 /**
2205 * Sets the value of the `FormGroup`. It accepts an object that matches
2206 * the structure of the group, with control names as keys.
2207 *
2208 * @usageNotes
2209 * ### Set the complete value for the form group
2210 *
2211 * ```
2212 * const form = new FormGroup({
2213 * first: new FormControl(),
2214 * last: new FormControl()
2215 * });
2216 *
2217 * console.log(form.value); // {first: null, last: null}
2218 *
2219 * form.setValue({first: 'Nancy', last: 'Drew'});
2220 * console.log(form.value); // {first: 'Nancy', last: 'Drew'}
2221 * ```
2222 *
2223 * @throws When strict checks fail, such as setting the value of a control
2224 * that doesn't exist or if you exclude a value of a control that does exist.
2225 *
2226 * @param value The new value for the control that matches the structure of the group.
2227 * @param options Configuration options that determine how the control propagates changes
2228 * and emits events after the value changes.
2229 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
2230 * updateValueAndValidity} method.
2231 *
2232 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
2233 * false.
2234 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
2235 * `valueChanges`
2236 * observables emit events with the latest status and value when the control value is updated.
2237 * When false, no events are emitted.
2238 */
2239 setValue(value: {
2240 [key: string]: any;
2241 }, options?: {
2242 onlySelf?: boolean;
2243 emitEvent?: boolean;
2244 }): void;
2245 /**
2246 * Patches the value of the `FormGroup`. It accepts an object with control
2247 * names as keys, and does its best to match the values to the correct controls
2248 * in the group.
2249 *
2250 * It accepts both super-sets and sub-sets of the group without throwing an error.
2251 *
2252 * @usageNotes
2253 * ### Patch the value for a form group
2254 *
2255 * ```
2256 * const form = new FormGroup({
2257 * first: new FormControl(),
2258 * last: new FormControl()
2259 * });
2260 * console.log(form.value); // {first: null, last: null}
2261 *
2262 * form.patchValue({first: 'Nancy'});
2263 * console.log(form.value); // {first: 'Nancy', last: null}
2264 * ```
2265 *
2266 * @param value The object that matches the structure of the group.
2267 * @param options Configuration options that determine how the control propagates changes and
2268 * emits events after the value is patched.
2269 * * `onlySelf`: When true, each change only affects this control and not its parent. Default is
2270 * true.
2271 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
2272 * `valueChanges` observables emit events with the latest status and value when the control value
2273 * is updated. When false, no events are emitted. The configuration options are passed to
2274 * the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
2275 */
2276 patchValue(value: {
2277 [key: string]: any;
2278 }, options?: {
2279 onlySelf?: boolean;
2280 emitEvent?: boolean;
2281 }): void;
2282 /**
2283 * Resets the `FormGroup`, marks all descendants `pristine` and `untouched` and sets
2284 * the value of all descendants to null.
2285 *
2286 * You reset to a specific form state by passing in a map of states
2287 * that matches the structure of your form, with control names as keys. The state
2288 * is a standalone value or a form state object with both a value and a disabled
2289 * status.
2290 *
2291 * @param value Resets the control with an initial value,
2292 * or an object that defines the initial value and disabled state.
2293 *
2294 * @param options Configuration options that determine how the control propagates changes
2295 * and emits events when the group is reset.
2296 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
2297 * false.
2298 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
2299 * `valueChanges`
2300 * observables emit events with the latest status and value when the control is reset.
2301 * When false, no events are emitted.
2302 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
2303 * updateValueAndValidity} method.
2304 *
2305 * @usageNotes
2306 *
2307 * ### Reset the form group values
2308 *
2309 * ```ts
2310 * const form = new FormGroup({
2311 * first: new FormControl('first name'),
2312 * last: new FormControl('last name')
2313 * });
2314 *
2315 * console.log(form.value); // {first: 'first name', last: 'last name'}
2316 *
2317 * form.reset({ first: 'name', last: 'last name' });
2318 *
2319 * console.log(form.value); // {first: 'name', last: 'last name'}
2320 * ```
2321 *
2322 * ### Reset the form group values and disabled status
2323 *
2324 * ```
2325 * const form = new FormGroup({
2326 * first: new FormControl('first name'),
2327 * last: new FormControl('last name')
2328 * });
2329 *
2330 * form.reset({
2331 * first: {value: 'name', disabled: true},
2332 * last: 'last'
2333 * });
2334 *
2335 * console.log(form.value); // {last: 'last'}
2336 * console.log(form.get('first').status); // 'DISABLED'
2337 * ```
2338 */
2339 reset(value?: any, options?: {
2340 onlySelf?: boolean;
2341 emitEvent?: boolean;
2342 }): void;
2343 /**
2344 * The aggregate value of the `FormGroup`, including any disabled controls.
2345 *
2346 * Retrieves all values regardless of disabled status.
2347 * The `value` property is the best way to get the value of the group, because
2348 * it excludes disabled controls in the `FormGroup`.
2349 */
2350 getRawValue(): any;
2351}
2352
2353/**
2354 * @description
2355 *
2356 * Binds an existing `FormGroup` to a DOM element.
2357 *
2358 * This directive accepts an existing `FormGroup` instance. It will then use this
2359 * `FormGroup` instance to match any child `FormControl`, `FormGroup`,
2360 * and `FormArray` instances to child `FormControlName`, `FormGroupName`,
2361 * and `FormArrayName` directives.
2362 *
2363 * @see [Reactive Forms Guide](guide/reactive-forms)
2364 * @see `AbstractControl`
2365 *
2366 * @usageNotes
2367 * ### Register Form Group
2368 *
2369 * The following example registers a `FormGroup` with first name and last name controls,
2370 * and listens for the *ngSubmit* event when the button is clicked.
2371 *
2372 * {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
2373 *
2374 * @ngModule ReactiveFormsModule
2375 * @publicApi
2376 */
2377export declare class FormGroupDirective extends ControlContainer implements Form, OnChanges, OnDestroy {
2378 private validators;
2379 private asyncValidators;
2380 /**
2381 * @description
2382 * Reports whether the form submission has been triggered.
2383 */
2384 readonly submitted: boolean;
2385 /**
2386 * Reference to an old form group input value, which is needed to cleanup old instance in case it
2387 * was replaced with a new one.
2388 */
2389 private _oldForm;
2390 /**
2391 * Callback that should be invoked when controls in FormGroup or FormArray collection change
2392 * (added or removed). This callback triggers corresponding DOM updates.
2393 */
2394 private readonly _onCollectionChange;
2395 /**
2396 * @description
2397 * Tracks the list of added `FormControlName` instances
2398 */
2399 directives: FormControlName[];
2400 /**
2401 * @description
2402 * Tracks the `FormGroup` bound to this directive.
2403 */
2404 form: FormGroup;
2405 /**
2406 * @description
2407 * Emits an event when the form submission has been triggered.
2408 */
2409 ngSubmit: EventEmitter<any>;
2410 constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
2411 /** @nodoc */
2412 ngOnChanges(changes: SimpleChanges): void;
2413 /** @nodoc */
2414 ngOnDestroy(): void;
2415 /**
2416 * @description
2417 * Returns this directive's instance.
2418 */
2419 get formDirective(): Form;
2420 /**
2421 * @description
2422 * Returns the `FormGroup` bound to this directive.
2423 */
2424 get control(): FormGroup;
2425 /**
2426 * @description
2427 * Returns an array representing the path to this group. Because this directive
2428 * always lives at the top level of a form, it always an empty array.
2429 */
2430 get path(): string[];
2431 /**
2432 * @description
2433 * Method that sets up the control directive in this group, re-calculates its value
2434 * and validity, and adds the instance to the internal list of directives.
2435 *
2436 * @param dir The `FormControlName` directive instance.
2437 */
2438 addControl(dir: FormControlName): FormControl;
2439 /**
2440 * @description
2441 * Retrieves the `FormControl` instance from the provided `FormControlName` directive
2442 *
2443 * @param dir The `FormControlName` directive instance.
2444 */
2445 getControl(dir: FormControlName): FormControl;
2446 /**
2447 * @description
2448 * Removes the `FormControlName` instance from the internal list of directives
2449 *
2450 * @param dir The `FormControlName` directive instance.
2451 */
2452 removeControl(dir: FormControlName): void;
2453 /**
2454 * Adds a new `FormGroupName` directive instance to the form.
2455 *
2456 * @param dir The `FormGroupName` directive instance.
2457 */
2458 addFormGroup(dir: FormGroupName): void;
2459 /**
2460 * Performs the necessary cleanup when a `FormGroupName` directive instance is removed from the
2461 * view.
2462 *
2463 * @param dir The `FormGroupName` directive instance.
2464 */
2465 removeFormGroup(dir: FormGroupName): void;
2466 /**
2467 * @description
2468 * Retrieves the `FormGroup` for a provided `FormGroupName` directive instance
2469 *
2470 * @param dir The `FormGroupName` directive instance.
2471 */
2472 getFormGroup(dir: FormGroupName): FormGroup;
2473 /**
2474 * Performs the necessary setup when a `FormArrayName` directive instance is added to the view.
2475 *
2476 * @param dir The `FormArrayName` directive instance.
2477 */
2478 addFormArray(dir: FormArrayName): void;
2479 /**
2480 * Performs the necessary cleanup when a `FormArrayName` directive instance is removed from the
2481 * view.
2482 *
2483 * @param dir The `FormArrayName` directive instance.
2484 */
2485 removeFormArray(dir: FormArrayName): void;
2486 /**
2487 * @description
2488 * Retrieves the `FormArray` for a provided `FormArrayName` directive instance.
2489 *
2490 * @param dir The `FormArrayName` directive instance.
2491 */
2492 getFormArray(dir: FormArrayName): FormArray;
2493 /**
2494 * Sets the new value for the provided `FormControlName` directive.
2495 *
2496 * @param dir The `FormControlName` directive instance.
2497 * @param value The new value for the directive's control.
2498 */
2499 updateModel(dir: FormControlName, value: any): void;
2500 /**
2501 * @description
2502 * Method called with the "submit" event is triggered on the form.
2503 * Triggers the `ngSubmit` emitter to emit the "submit" event as its payload.
2504 *
2505 * @param $event The "submit" event object
2506 */
2507 onSubmit($event: Event): boolean;
2508 /**
2509 * @description
2510 * Method called when the "reset" event is triggered on the form.
2511 */
2512 onReset(): void;
2513 /**
2514 * @description
2515 * Resets the form to an initial value and resets its submitted status.
2516 *
2517 * @param value The new value for the form.
2518 */
2519 resetForm(value?: any): void;
2520 private _setUpFormContainer;
2521 private _cleanUpFormContainer;
2522 private _updateRegistrations;
2523 private _updateValidators;
2524 private _checkFormPresent;
2525}
2526
2527/**
2528 * @description
2529 *
2530 * Syncs a nested `FormGroup` to a DOM element.
2531 *
2532 * This directive can only be used with a parent `FormGroupDirective`.
2533 *
2534 * It accepts the string name of the nested `FormGroup` to link, and
2535 * looks for a `FormGroup` registered with that name in the parent
2536 * `FormGroup` instance you passed into `FormGroupDirective`.
2537 *
2538 * Use nested form groups to validate a sub-group of a
2539 * form separately from the rest or to group the values of certain
2540 * controls into their own nested object.
2541 *
2542 * @see [Reactive Forms Guide](guide/reactive-forms)
2543 *
2544 * @usageNotes
2545 *
2546 * ### Access the group by name
2547 *
2548 * The following example uses the {@link AbstractControl#get get} method to access the
2549 * associated `FormGroup`
2550 *
2551 * ```ts
2552 * this.form.get('name');
2553 * ```
2554 *
2555 * ### Access individual controls in the group
2556 *
2557 * The following example uses the {@link AbstractControl#get get} method to access
2558 * individual controls within the group using dot syntax.
2559 *
2560 * ```ts
2561 * this.form.get('name.first');
2562 * ```
2563 *
2564 * ### Register a nested `FormGroup`.
2565 *
2566 * The following example registers a nested *name* `FormGroup` within an existing `FormGroup`,
2567 * and provides methods to retrieve the nested `FormGroup` and individual controls.
2568 *
2569 * {@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'}
2570 *
2571 * @ngModule ReactiveFormsModule
2572 * @publicApi
2573 */
2574export declare class FormGroupName extends AbstractFormGroupDirective implements OnInit, OnDestroy {
2575 /**
2576 * @description
2577 * Tracks the name of the `FormGroup` bound to the directive. The name corresponds
2578 * to a key in the parent `FormGroup` or `FormArray`.
2579 * Accepts a name as a string or a number.
2580 * The name in the form of a string is useful for individual forms,
2581 * while the numerical form allows for form groups to be bound
2582 * to indices when iterating over groups in a `FormArray`.
2583 */
2584 name: string | number | null;
2585 constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
2586}
2587
2588declare type FormHooks = 'change' | 'blur' | 'submit';
2589
2590/**
2591 * Exports the required providers and directives for template-driven forms,
2592 * making them available for import by NgModules that import this module.
2593 *
2594 * Providers associated with this module:
2595 * * `RadioControlRegistry`
2596 *
2597 * @see [Forms Overview](/guide/forms-overview)
2598 * @see [Template-driven Forms Guide](/guide/forms)
2599 *
2600 * @publicApi
2601 */
2602export declare class FormsModule {
2603}
2604
2605/**
2606 * A directive that adds max length validation to controls marked with the
2607 * `maxlength` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list.
2608 *
2609 * @see [Form Validation](guide/form-validation)
2610 *
2611 * @usageNotes
2612 *
2613 * ### Adding a maximum length validator
2614 *
2615 * The following example shows how to add a maximum length validator to an input attached to an
2616 * ngModel binding.
2617 *
2618 * ```html
2619 * <input name="firstName" ngModel maxlength="25">
2620 * ```
2621 *
2622 * @ngModule ReactiveFormsModule
2623 * @ngModule FormsModule
2624 * @publicApi
2625 */
2626export declare class MaxLengthValidator implements Validator, OnChanges {
2627 private _validator;
2628 private _onChange?;
2629 /**
2630 * @description
2631 * Tracks changes to the maximum length bound to this directive.
2632 */
2633 maxlength: string | number;
2634 /** @nodoc */
2635 ngOnChanges(changes: SimpleChanges): void;
2636 /**
2637 * Method that validates whether the value exceeds the maximum length requirement.
2638 * @nodoc
2639 */
2640 validate(control: AbstractControl): ValidationErrors | null;
2641 /**
2642 * Registers a callback function to call when the validator inputs change.
2643 * @nodoc
2644 */
2645 registerOnValidatorChange(fn: () => void): void;
2646 private _createValidator;
2647}
2648
2649/**
2650 * A directive which installs the {@link MaxValidator} for any `formControlName`,
2651 * `formControl`, or control with `ngModel` that also has a `max` attribute.
2652 *
2653 * @see [Form Validation](guide/form-validation)
2654 *
2655 * @usageNotes
2656 *
2657 * ### Adding a max validator
2658 *
2659 * The following example shows how to add a max validator to an input attached to an
2660 * ngModel binding.
2661 *
2662 * ```html
2663 * <input type="number" ngModel max="4">
2664 * ```
2665 *
2666 * @ngModule ReactiveFormsModule
2667 * @ngModule FormsModule
2668 * @publicApi
2669 */
2670export declare class MaxValidator extends AbstractValidatorDirective implements OnChanges {
2671 /**
2672 * @description
2673 * Tracks changes to the max bound to this directive.
2674 */
2675 max: string | number;
2676 /**
2677 * Declare `ngOnChanges` lifecycle hook at the main directive level (vs keeping it in base class)
2678 * to avoid differences in handling inheritance of lifecycle hooks between Ivy and ViewEngine in
2679 * AOT mode. This could be refactored once ViewEngine is removed.
2680 * @nodoc
2681 */
2682 ngOnChanges(changes: SimpleChanges): void;
2683}
2684
2685/**
2686 * A directive that adds minimum length validation to controls marked with the
2687 * `minlength` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list.
2688 *
2689 * @see [Form Validation](guide/form-validation)
2690 *
2691 * @usageNotes
2692 *
2693 * ### Adding a minimum length validator
2694 *
2695 * The following example shows how to add a minimum length validator to an input attached to an
2696 * ngModel binding.
2697 *
2698 * ```html
2699 * <input name="firstName" ngModel minlength="4">
2700 * ```
2701 *
2702 * @ngModule ReactiveFormsModule
2703 * @ngModule FormsModule
2704 * @publicApi
2705 */
2706export declare class MinLengthValidator implements Validator, OnChanges {
2707 private _validator;
2708 private _onChange?;
2709 /**
2710 * @description
2711 * Tracks changes to the minimum length bound to this directive.
2712 */
2713 minlength: string | number;
2714 /** @nodoc */
2715 ngOnChanges(changes: SimpleChanges): void;
2716 /**
2717 * Method that validates whether the value meets a minimum length requirement.
2718 * Returns the validation result if enabled, otherwise null.
2719 * @nodoc
2720 */
2721 validate(control: AbstractControl): ValidationErrors | null;
2722 /**
2723 * Registers a callback function to call when the validator inputs change.
2724 * @nodoc
2725 */
2726 registerOnValidatorChange(fn: () => void): void;
2727 private _createValidator;
2728}
2729
2730/**
2731 * A directive which installs the {@link MinValidator} for any `formControlName`,
2732 * `formControl`, or control with `ngModel` that also has a `min` attribute.
2733 *
2734 * @see [Form Validation](guide/form-validation)
2735 *
2736 * @usageNotes
2737 *
2738 * ### Adding a min validator
2739 *
2740 * The following example shows how to add a min validator to an input attached to an
2741 * ngModel binding.
2742 *
2743 * ```html
2744 * <input type="number" ngModel min="4">
2745 * ```
2746 *
2747 * @ngModule ReactiveFormsModule
2748 * @ngModule FormsModule
2749 * @publicApi
2750 */
2751export declare class MinValidator extends AbstractValidatorDirective implements OnChanges {
2752 /**
2753 * @description
2754 * Tracks changes to the min bound to this directive.
2755 */
2756 min: string | number;
2757 /**
2758 * Declare `ngOnChanges` lifecycle hook at the main directive level (vs keeping it in base class)
2759 * to avoid differences in handling inheritance of lifecycle hooks between Ivy and ViewEngine in
2760 * AOT mode. This could be refactored once ViewEngine is removed.
2761 * @nodoc
2762 */
2763 ngOnChanges(changes: SimpleChanges): void;
2764}
2765
2766/**
2767 * @description
2768 * An `InjectionToken` for registering additional asynchronous validators used with
2769 * `AbstractControl`s.
2770 *
2771 * @see `NG_VALIDATORS`
2772 *
2773 * @publicApi
2774 */
2775export declare const NG_ASYNC_VALIDATORS: InjectionToken<(Function | Validator)[]>;
2776
2777/**
2778 * @description
2779 * An `InjectionToken` for registering additional synchronous validators used with
2780 * `AbstractControl`s.
2781 *
2782 * @see `NG_ASYNC_VALIDATORS`
2783 *
2784 * @usageNotes
2785 *
2786 * ### Providing a custom validator
2787 *
2788 * The following example registers a custom validator directive. Adding the validator to the
2789 * existing collection of validators requires the `multi: true` option.
2790 *
2791 * ```typescript
2792 * @Directive({
2793 * selector: '[customValidator]',
2794 * providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}]
2795 * })
2796 * class CustomValidatorDirective implements Validator {
2797 * validate(control: AbstractControl): ValidationErrors | null {
2798 * return { 'custom': true };
2799 * }
2800 * }
2801 * ```
2802 *
2803 * @publicApi
2804 */
2805export declare const NG_VALIDATORS: InjectionToken<(Function | Validator)[]>;
2806
2807/**
2808 * Used to provide a `ControlValueAccessor` for form controls.
2809 *
2810 * See `DefaultValueAccessor` for how to implement one.
2811 *
2812 * @publicApi
2813 */
2814export declare const NG_VALUE_ACCESSOR: InjectionToken<readonly ControlValueAccessor[]>;
2815
2816/**
2817 * @description
2818 * A base class that all `FormControl`-based directives extend. It binds a `FormControl`
2819 * object to a DOM element.
2820 *
2821 * @publicApi
2822 */
2823export declare abstract class NgControl extends AbstractControlDirective {
2824 /**
2825 * @description
2826 * The name for the control
2827 */
2828 name: string | number | null;
2829 /**
2830 * @description
2831 * The value accessor for the control
2832 */
2833 valueAccessor: ControlValueAccessor | null;
2834 /**
2835 * @description
2836 * The callback method to update the model from the view when requested
2837 *
2838 * @param newValue The new value for the view
2839 */
2840 abstract viewToModelUpdate(newValue: any): void;
2841}
2842
2843/**
2844 * @description
2845 * Directive automatically applied to Angular form controls that sets CSS classes
2846 * based on control status.
2847 *
2848 * @usageNotes
2849 *
2850 * ### CSS classes applied
2851 *
2852 * The following classes are applied as the properties become true:
2853 *
2854 * * ng-valid
2855 * * ng-invalid
2856 * * ng-pending
2857 * * ng-pristine
2858 * * ng-dirty
2859 * * ng-untouched
2860 * * ng-touched
2861 *
2862 * @ngModule ReactiveFormsModule
2863 * @ngModule FormsModule
2864 * @publicApi
2865 */
2866export declare class NgControlStatus extends ɵangular_packages_forms_forms_i {
2867 constructor(cd: NgControl);
2868}
2869
2870/**
2871 * @description
2872 * Directive automatically applied to Angular form groups that sets CSS classes
2873 * based on control status (valid/invalid/dirty/etc).
2874 *
2875 * @see `NgControlStatus`
2876 *
2877 * @ngModule ReactiveFormsModule
2878 * @ngModule FormsModule
2879 * @publicApi
2880 */
2881export declare class NgControlStatusGroup extends ɵangular_packages_forms_forms_i {
2882 constructor(cd: ControlContainer);
2883}
2884
2885/**
2886 * @description
2887 * Creates a top-level `FormGroup` instance and binds it to a form
2888 * to track aggregate form value and validation status.
2889 *
2890 * As soon as you import the `FormsModule`, this directive becomes active by default on
2891 * all `<form>` tags. You don't need to add a special selector.
2892 *
2893 * You optionally export the directive into a local template variable using `ngForm` as the key
2894 * (ex: `#myForm="ngForm"`). This is optional, but useful. Many properties from the underlying
2895 * `FormGroup` instance are duplicated on the directive itself, so a reference to it
2896 * gives you access to the aggregate value and validity status of the form, as well as
2897 * user interaction properties like `dirty` and `touched`.
2898 *
2899 * To register child controls with the form, use `NgModel` with a `name`
2900 * attribute. You may use `NgModelGroup` to create sub-groups within the form.
2901 *
2902 * If necessary, listen to the directive's `ngSubmit` event to be notified when the user has
2903 * triggered a form submission. The `ngSubmit` event emits the original form
2904 * submission event.
2905 *
2906 * In template driven forms, all `<form>` tags are automatically tagged as `NgForm`.
2907 * To import the `FormsModule` but skip its usage in some forms,
2908 * for example, to use native HTML5 validation, add the `ngNoForm` and the `<form>`
2909 * tags won't create an `NgForm` directive. In reactive forms, using `ngNoForm` is
2910 * unnecessary because the `<form>` tags are inert. In that case, you would
2911 * refrain from using the `formGroup` directive.
2912 *
2913 * @usageNotes
2914 *
2915 * ### Listening for form submission
2916 *
2917 * The following example shows how to capture the form values from the "ngSubmit" event.
2918 *
2919 * {@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
2920 *
2921 * ### Setting the update options
2922 *
2923 * The following example shows you how to change the "updateOn" option from its default using
2924 * ngFormOptions.
2925 *
2926 * ```html
2927 * <form [ngFormOptions]="{updateOn: 'blur'}">
2928 * <input name="one" ngModel> <!-- this ngModel will update on blur -->
2929 * </form>
2930 * ```
2931 *
2932 * ### Native DOM validation UI
2933 *
2934 * In order to prevent the native DOM form validation UI from interfering with Angular's form
2935 * validation, Angular automatically adds the `novalidate` attribute on any `<form>` whenever
2936 * `FormModule` or `ReactiveFormModule` are imported into the application.
2937 * If you want to explicitly enable native DOM validation UI with Angular forms, you can add the
2938 * `ngNativeValidate` attribute to the `<form>` element:
2939 *
2940 * ```html
2941 * <form ngNativeValidate>
2942 * ...
2943 * </form>
2944 * ```
2945 *
2946 * @ngModule FormsModule
2947 * @publicApi
2948 */
2949export declare class NgForm extends ControlContainer implements Form, AfterViewInit {
2950 /**
2951 * @description
2952 * Returns whether the form submission has been triggered.
2953 */
2954 readonly submitted: boolean;
2955 private _directives;
2956 /**
2957 * @description
2958 * The `FormGroup` instance created for this form.
2959 */
2960 form: FormGroup;
2961 /**
2962 * @description
2963 * Event emitter for the "ngSubmit" event
2964 */
2965 ngSubmit: EventEmitter<any>;
2966 /**
2967 * @description
2968 * Tracks options for the `NgForm` instance.
2969 *
2970 * **updateOn**: Sets the default `updateOn` value for all child `NgModels` below it
2971 * unless explicitly set by a child `NgModel` using `ngModelOptions`). Defaults to 'change'.
2972 * Possible values: `'change'` | `'blur'` | `'submit'`.
2973 *
2974 */
2975 options: {
2976 updateOn?: FormHooks;
2977 };
2978 constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
2979 /** @nodoc */
2980 ngAfterViewInit(): void;
2981 /**
2982 * @description
2983 * The directive instance.
2984 */
2985 get formDirective(): Form;
2986 /**
2987 * @description
2988 * The internal `FormGroup` instance.
2989 */
2990 get control(): FormGroup;
2991 /**
2992 * @description
2993 * Returns an array representing the path to this group. Because this directive
2994 * always lives at the top level of a form, it is always an empty array.
2995 */
2996 get path(): string[];
2997 /**
2998 * @description
2999 * Returns a map of the controls in this group.
3000 */
3001 get controls(): {
3002 [key: string]: AbstractControl;
3003 };
3004 /**
3005 * @description
3006 * Method that sets up the control directive in this group, re-calculates its value
3007 * and validity, and adds the instance to the internal list of directives.
3008 *
3009 * @param dir The `NgModel` directive instance.
3010 */
3011 addControl(dir: NgModel): void;
3012 /**
3013 * @description
3014 * Retrieves the `FormControl` instance from the provided `NgModel` directive.
3015 *
3016 * @param dir The `NgModel` directive instance.
3017 */
3018 getControl(dir: NgModel): FormControl;
3019 /**
3020 * @description
3021 * Removes the `NgModel` instance from the internal list of directives
3022 *
3023 * @param dir The `NgModel` directive instance.
3024 */
3025 removeControl(dir: NgModel): void;
3026 /**
3027 * @description
3028 * Adds a new `NgModelGroup` directive instance to the form.
3029 *
3030 * @param dir The `NgModelGroup` directive instance.
3031 */
3032 addFormGroup(dir: NgModelGroup): void;
3033 /**
3034 * @description
3035 * Removes the `NgModelGroup` directive instance from the form.
3036 *
3037 * @param dir The `NgModelGroup` directive instance.
3038 */
3039 removeFormGroup(dir: NgModelGroup): void;
3040 /**
3041 * @description
3042 * Retrieves the `FormGroup` for a provided `NgModelGroup` directive instance
3043 *
3044 * @param dir The `NgModelGroup` directive instance.
3045 */
3046 getFormGroup(dir: NgModelGroup): FormGroup;
3047 /**
3048 * Sets the new value for the provided `NgControl` directive.
3049 *
3050 * @param dir The `NgControl` directive instance.
3051 * @param value The new value for the directive's control.
3052 */
3053 updateModel(dir: NgControl, value: any): void;
3054 /**
3055 * @description
3056 * Sets the value for this `FormGroup`.
3057 *
3058 * @param value The new value
3059 */
3060 setValue(value: {
3061 [key: string]: any;
3062 }): void;
3063 /**
3064 * @description
3065 * Method called when the "submit" event is triggered on the form.
3066 * Triggers the `ngSubmit` emitter to emit the "submit" event as its payload.
3067 *
3068 * @param $event The "submit" event object
3069 */
3070 onSubmit($event: Event): boolean;
3071 /**
3072 * @description
3073 * Method called when the "reset" event is triggered on the form.
3074 */
3075 onReset(): void;
3076 /**
3077 * @description
3078 * Resets the form to an initial value and resets its submitted status.
3079 *
3080 * @param value The new value for the form.
3081 */
3082 resetForm(value?: any): void;
3083 private _setUpdateStrategy;
3084}
3085
3086/**
3087 * @description
3088 * Creates a `FormControl` instance from a domain model and binds it
3089 * to a form control element.
3090 *
3091 * The `FormControl` instance tracks the value, user interaction, and
3092 * validation status of the control and keeps the view synced with the model. If used
3093 * within a parent form, the directive also registers itself with the form as a child
3094 * control.
3095 *
3096 * This directive is used by itself or as part of a larger form. Use the
3097 * `ngModel` selector to activate it.
3098 *
3099 * It accepts a domain model as an optional `Input`. If you have a one-way binding
3100 * to `ngModel` with `[]` syntax, changing the domain model's value in the component
3101 * class sets the value in the view. If you have a two-way binding with `[()]` syntax
3102 * (also known as 'banana-in-a-box syntax'), the value in the UI always syncs back to
3103 * the domain model in your class.
3104 *
3105 * To inspect the properties of the associated `FormControl` (like the validity state),
3106 * export the directive into a local template variable using `ngModel` as the key (ex:
3107 * `#myVar="ngModel"`). You can then access the control using the directive's `control` property.
3108 * However, the most commonly used properties (like `valid` and `dirty`) also exist on the control
3109 * for direct access. See a full list of properties directly available in
3110 * `AbstractControlDirective`.
3111 *
3112 * @see `RadioControlValueAccessor`
3113 * @see `SelectControlValueAccessor`
3114 *
3115 * @usageNotes
3116 *
3117 * ### Using ngModel on a standalone control
3118 *
3119 * The following examples show a simple standalone control using `ngModel`:
3120 *
3121 * {@example forms/ts/simpleNgModel/simple_ng_model_example.ts region='Component'}
3122 *
3123 * When using the `ngModel` within `<form>` tags, you'll also need to supply a `name` attribute
3124 * so that the control can be registered with the parent form under that name.
3125 *
3126 * In the context of a parent form, it's often unnecessary to include one-way or two-way binding,
3127 * as the parent form syncs the value for you. You access its properties by exporting it into a
3128 * local template variable using `ngForm` such as (`#f="ngForm"`). Use the variable where
3129 * needed on form submission.
3130 *
3131 * If you do need to populate initial values into your form, using a one-way binding for
3132 * `ngModel` tends to be sufficient as long as you use the exported form's value rather
3133 * than the domain model's value on submit.
3134 *
3135 * ### Using ngModel within a form
3136 *
3137 * The following example shows controls using `ngModel` within a form:
3138 *
3139 * {@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
3140 *
3141 * ### Using a standalone ngModel within a group
3142 *
3143 * The following example shows you how to use a standalone ngModel control
3144 * within a form. This controls the display of the form, but doesn't contain form data.
3145 *
3146 * ```html
3147 * <form>
3148 * <input name="login" ngModel placeholder="Login">
3149 * <input type="checkbox" ngModel [ngModelOptions]="{standalone: true}"> Show more options?
3150 * </form>
3151 * <!-- form value: {login: ''} -->
3152 * ```
3153 *
3154 * ### Setting the ngModel `name` attribute through options
3155 *
3156 * The following example shows you an alternate way to set the name attribute. Here,
3157 * an attribute identified as name is used within a custom form control component. To still be able
3158 * to specify the NgModel's name, you must specify it using the `ngModelOptions` input instead.
3159 *
3160 * ```html
3161 * <form>
3162 * <my-custom-form-control name="Nancy" ngModel [ngModelOptions]="{name: 'user'}">
3163 * </my-custom-form-control>
3164 * </form>
3165 * <!-- form value: {user: ''} -->
3166 * ```
3167 *
3168 * @ngModule FormsModule
3169 * @publicApi
3170 */
3171export declare class NgModel extends NgControl implements OnChanges, OnDestroy {
3172 readonly control: FormControl;
3173 /** @nodoc */
3174 static ngAcceptInputType_isDisabled: boolean | string;
3175 /**
3176 * Internal reference to the view model value.
3177 * @nodoc
3178 */
3179 viewModel: any;
3180 /**
3181 * @description
3182 * Tracks the name bound to the directive. If a parent form exists, it
3183 * uses this name as a key to retrieve this control's value.
3184 */
3185 name: string;
3186 /**
3187 * @description
3188 * Tracks whether the control is disabled.
3189 */
3190 isDisabled: boolean;
3191 /**
3192 * @description
3193 * Tracks the value bound to this directive.
3194 */
3195 model: any;
3196 /**
3197 * @description
3198 * Tracks the configuration options for this `ngModel` instance.
3199 *
3200 * **name**: An alternative to setting the name attribute on the form control element. See
3201 * the [example](api/forms/NgModel#using-ngmodel-on-a-standalone-control) for using `NgModel`
3202 * as a standalone control.
3203 *
3204 * **standalone**: When set to true, the `ngModel` will not register itself with its parent form,
3205 * and acts as if it's not in the form. Defaults to false. If no parent form exists, this option
3206 * has no effect.
3207 *
3208 * **updateOn**: Defines the event upon which the form control value and validity update.
3209 * Defaults to 'change'. Possible values: `'change'` | `'blur'` | `'submit'`.
3210 *
3211 */
3212 options: {
3213 name?: string;
3214 standalone?: boolean;
3215 updateOn?: FormHooks;
3216 };
3217 /**
3218 * @description
3219 * Event emitter for producing the `ngModelChange` event after
3220 * the view model updates.
3221 */
3222 update: EventEmitter<any>;
3223 constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[]);
3224 /** @nodoc */
3225 ngOnChanges(changes: SimpleChanges): void;
3226 /** @nodoc */
3227 ngOnDestroy(): void;
3228 /**
3229 * @description
3230 * Returns an array that represents the path from the top-level form to this control.
3231 * Each index is the string name of the control on that level.
3232 */
3233 get path(): string[];
3234 /**
3235 * @description
3236 * The top-level directive for this control if present, otherwise null.
3237 */
3238 get formDirective(): any;
3239 /**
3240 * @description
3241 * Sets the new value for the view model and emits an `ngModelChange` event.
3242 *
3243 * @param newValue The new value emitted by `ngModelChange`.
3244 */
3245 viewToModelUpdate(newValue: any): void;
3246 private _setUpControl;
3247 private _setUpdateStrategy;
3248 private _isStandalone;
3249 private _setUpStandalone;
3250 private _checkForErrors;
3251 private _checkParentType;
3252 private _checkName;
3253 private _updateValue;
3254 private _updateDisabled;
3255}
3256
3257/**
3258 * @description
3259 * Creates and binds a `FormGroup` instance to a DOM element.
3260 *
3261 * This directive can only be used as a child of `NgForm` (within `<form>` tags).
3262 *
3263 * Use this directive to validate a sub-group of your form separately from the
3264 * rest of your form, or if some values in your domain model make more sense
3265 * to consume together in a nested object.
3266 *
3267 * Provide a name for the sub-group and it will become the key
3268 * for the sub-group in the form's full value. If you need direct access, export the directive into
3269 * a local template variable using `ngModelGroup` (ex: `#myGroup="ngModelGroup"`).
3270 *
3271 * @usageNotes
3272 *
3273 * ### Consuming controls in a grouping
3274 *
3275 * The following example shows you how to combine controls together in a sub-group
3276 * of the form.
3277 *
3278 * {@example forms/ts/ngModelGroup/ng_model_group_example.ts region='Component'}
3279 *
3280 * @ngModule FormsModule
3281 * @publicApi
3282 */
3283export declare class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy {
3284 /**
3285 * @description
3286 * Tracks the name of the `NgModelGroup` bound to the directive. The name corresponds
3287 * to a key in the parent `NgForm`.
3288 */
3289 name: string;
3290 constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
3291}
3292
3293/**
3294 * @description
3295 * Marks `<option>` as dynamic, so Angular can be notified when options change.
3296 *
3297 * @see `SelectControlValueAccessor`
3298 *
3299 * @ngModule ReactiveFormsModule
3300 * @ngModule FormsModule
3301 * @publicApi
3302 */
3303export declare class NgSelectOption implements OnDestroy {
3304 private _element;
3305 private _renderer;
3306 private _select;
3307 /**
3308 * @description
3309 * ID of the option element
3310 */
3311 id: string;
3312 constructor(_element: ElementRef, _renderer: Renderer2, _select: SelectControlValueAccessor);
3313 /**
3314 * @description
3315 * Tracks the value bound to the option element. Unlike the value binding,
3316 * ngValue supports binding to objects.
3317 */
3318 set ngValue(value: any);
3319 /**
3320 * @description
3321 * Tracks simple string values bound to the option element.
3322 * For objects, use the `ngValue` input binding.
3323 */
3324 set value(value: any);
3325 /** @nodoc */
3326 ngOnDestroy(): void;
3327}
3328
3329/**
3330 * @description
3331 * The `ControlValueAccessor` for writing a number value and listening to number input changes.
3332 * The value accessor is used by the `FormControlDirective`, `FormControlName`, and `NgModel`
3333 * directives.
3334 *
3335 * @usageNotes
3336 *
3337 * ### Using a number input with a reactive form.
3338 *
3339 * The following example shows how to use a number input with a reactive form.
3340 *
3341 * ```ts
3342 * const totalCountControl = new FormControl();
3343 * ```
3344 *
3345 * ```
3346 * <input type="number" [formControl]="totalCountControl">
3347 * ```
3348 *
3349 * @ngModule ReactiveFormsModule
3350 * @ngModule FormsModule
3351 * @publicApi
3352 */
3353export declare class NumberValueAccessor extends ɵangular_packages_forms_forms_g implements ControlValueAccessor {
3354 /**
3355 * Sets the "value" property on the input element.
3356 * @nodoc
3357 */
3358 writeValue(value: number): void;
3359 /**
3360 * Registers a function called when the control value changes.
3361 * @nodoc
3362 */
3363 registerOnChange(fn: (_: number | null) => void): void;
3364}
3365
3366/**
3367 * @description
3368 * A directive that adds regex pattern validation to controls marked with the
3369 * `pattern` attribute. The regex must match the entire control value.
3370 * The directive is provided with the `NG_VALIDATORS` multi-provider list.
3371 *
3372 * @see [Form Validation](guide/form-validation)
3373 *
3374 * @usageNotes
3375 *
3376 * ### Adding a pattern validator
3377 *
3378 * The following example shows how to add a pattern validator to an input attached to an
3379 * ngModel binding.
3380 *
3381 * ```html
3382 * <input name="firstName" ngModel pattern="[a-zA-Z ]*">
3383 * ```
3384 *
3385 * @ngModule ReactiveFormsModule
3386 * @ngModule FormsModule
3387 * @publicApi
3388 */
3389export declare class PatternValidator implements Validator, OnChanges {
3390 private _validator;
3391 private _onChange?;
3392 /**
3393 * @description
3394 * Tracks changes to the pattern bound to this directive.
3395 */
3396 pattern: string | RegExp;
3397 /** @nodoc */
3398 ngOnChanges(changes: SimpleChanges): void;
3399 /**
3400 * Method that validates whether the value matches the pattern requirement.
3401 * @nodoc
3402 */
3403 validate(control: AbstractControl): ValidationErrors | null;
3404 /**
3405 * Registers a callback function to call when the validator inputs change.
3406 * @nodoc
3407 */
3408 registerOnValidatorChange(fn: () => void): void;
3409 private _createValidator;
3410}
3411
3412/**
3413 * @description
3414 * The `ControlValueAccessor` for writing radio control values and listening to radio control
3415 * changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and
3416 * `NgModel` directives.
3417 *
3418 * @usageNotes
3419 *
3420 * ### Using radio buttons with reactive form directives
3421 *
3422 * The follow example shows how to use radio buttons in a reactive form. When using radio buttons in
3423 * a reactive form, radio buttons in the same group should have the same `formControlName`.
3424 * Providing a `name` attribute is optional.
3425 *
3426 * {@example forms/ts/reactiveRadioButtons/reactive_radio_button_example.ts region='Reactive'}
3427 *
3428 * @ngModule ReactiveFormsModule
3429 * @ngModule FormsModule
3430 * @publicApi
3431 */
3432export declare class RadioControlValueAccessor extends ɵangular_packages_forms_forms_g implements ControlValueAccessor, OnDestroy, OnInit {
3433 private _registry;
3434 private _injector;
3435 /**
3436 * The registered callback function called when a change event occurs on the input element.
3437 * Note: we declare `onChange` here (also used as host listener) as a function with no arguments
3438 * to override the `onChange` function (which expects 1 argument) in the parent
3439 * `BaseControlValueAccessor` class.
3440 * @nodoc
3441 */
3442 onChange: () => void;
3443 /**
3444 * @description
3445 * Tracks the name of the radio input element.
3446 */
3447 name: string;
3448 /**
3449 * @description
3450 * Tracks the name of the `FormControl` bound to the directive. The name corresponds
3451 * to a key in the parent `FormGroup` or `FormArray`.
3452 */
3453 formControlName: string;
3454 /**
3455 * @description
3456 * Tracks the value of the radio input element
3457 */
3458 value: any;
3459 constructor(renderer: Renderer2, elementRef: ElementRef, _registry: ɵangular_packages_forms_forms_q, _injector: Injector);
3460 /** @nodoc */
3461 ngOnInit(): void;
3462 /** @nodoc */
3463 ngOnDestroy(): void;
3464 /**
3465 * Sets the "checked" property value on the radio input element.
3466 * @nodoc
3467 */
3468 writeValue(value: any): void;
3469 /**
3470 * Registers a function called when the control value changes.
3471 * @nodoc
3472 */
3473 registerOnChange(fn: (_: any) => {}): void;
3474 /**
3475 * Sets the "value" on the radio input element and unchecks it.
3476 *
3477 * @param value
3478 */
3479 fireUncheck(value: any): void;
3480 private _checkName;
3481}
3482
3483/**
3484 * @description
3485 * The `ControlValueAccessor` for writing a range value and listening to range input changes.
3486 * The value accessor is used by the `FormControlDirective`, `FormControlName`, and `NgModel`
3487 * directives.
3488 *
3489 * @usageNotes
3490 *
3491 * ### Using a range input with a reactive form
3492 *
3493 * The following example shows how to use a range input with a reactive form.
3494 *
3495 * ```ts
3496 * const ageControl = new FormControl();
3497 * ```
3498 *
3499 * ```
3500 * <input type="range" [formControl]="ageControl">
3501 * ```
3502 *
3503 * @ngModule ReactiveFormsModule
3504 * @ngModule FormsModule
3505 * @publicApi
3506 */
3507export declare class RangeValueAccessor extends ɵangular_packages_forms_forms_g implements ControlValueAccessor {
3508 /**
3509 * Sets the "value" property on the input element.
3510 * @nodoc
3511 */
3512 writeValue(value: any): void;
3513 /**
3514 * Registers a function called when the control value changes.
3515 * @nodoc
3516 */
3517 registerOnChange(fn: (_: number | null) => void): void;
3518}
3519
3520/**
3521 * Exports the required infrastructure and directives for reactive forms,
3522 * making them available for import by NgModules that import this module.
3523 *
3524 * Providers associated with this module:
3525 * * `FormBuilder`
3526 * * `RadioControlRegistry`
3527 *
3528 * @see [Forms Overview](guide/forms-overview)
3529 * @see [Reactive Forms Guide](guide/reactive-forms)
3530 *
3531 * @publicApi
3532 */
3533export declare class ReactiveFormsModule {
3534 /**
3535 * @description
3536 * Provides options for configuring the reactive forms module.
3537 *
3538 * @param opts An object of configuration options
3539 * * `warnOnNgModelWithFormControl` Configures when to emit a warning when an `ngModel`
3540 * binding is used with reactive form directives.
3541 */
3542 static withConfig(opts: {
3543 /** @deprecated as of v6 */ warnOnNgModelWithFormControl: 'never' | 'once' | 'always';
3544 }): ModuleWithProviders<ReactiveFormsModule>;
3545}
3546
3547/**
3548 * @description
3549 * A directive that adds the `required` validator to any controls marked with the
3550 * `required` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list.
3551 *
3552 * @see [Form Validation](guide/form-validation)
3553 *
3554 * @usageNotes
3555 *
3556 * ### Adding a required validator using template-driven forms
3557 *
3558 * ```
3559 * <input name="fullName" ngModel required>
3560 * ```
3561 *
3562 * @ngModule FormsModule
3563 * @ngModule ReactiveFormsModule
3564 * @publicApi
3565 */
3566export declare class RequiredValidator implements Validator {
3567 private _required;
3568 private _onChange?;
3569 /**
3570 * @description
3571 * Tracks changes to the required attribute bound to this directive.
3572 */
3573 get required(): boolean | string;
3574 set required(value: boolean | string);
3575 /**
3576 * Method that validates whether the control is empty.
3577 * Returns the validation result if enabled, otherwise null.
3578 * @nodoc
3579 */
3580 validate(control: AbstractControl): ValidationErrors | null;
3581 /**
3582 * Registers a callback function to call when the validator inputs change.
3583 * @nodoc
3584 */
3585 registerOnValidatorChange(fn: () => void): void;
3586}
3587
3588/**
3589 * @description
3590 * The `ControlValueAccessor` for writing select control values and listening to select control
3591 * changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and
3592 * `NgModel` directives.
3593 *
3594 * @usageNotes
3595 *
3596 * ### Using select controls in a reactive form
3597 *
3598 * The following examples show how to use a select control in a reactive form.
3599 *
3600 * {@example forms/ts/reactiveSelectControl/reactive_select_control_example.ts region='Component'}
3601 *
3602 * ### Using select controls in a template-driven form
3603 *
3604 * To use a select in a template-driven form, simply add an `ngModel` and a `name`
3605 * attribute to the main `<select>` tag.
3606 *
3607 * {@example forms/ts/selectControl/select_control_example.ts region='Component'}
3608 *
3609 * ### Customizing option selection
3610 *
3611 * Angular uses object identity to select option. It's possible for the identities of items
3612 * to change while the data does not. This can happen, for example, if the items are produced
3613 * from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the
3614 * second response will produce objects with different identities.
3615 *
3616 * To customize the default option comparison algorithm, `<select>` supports `compareWith` input.
3617 * `compareWith` takes a **function** which has two arguments: `option1` and `option2`.
3618 * If `compareWith` is given, Angular selects option by the return value of the function.
3619 *
3620 * ```ts
3621 * const selectedCountriesControl = new FormControl();
3622 * ```
3623 *
3624 * ```
3625 * <select [compareWith]="compareFn" [formControl]="selectedCountriesControl">
3626 * <option *ngFor="let country of countries" [ngValue]="country">
3627 * {{country.name}}
3628 * </option>
3629 * </select>
3630 *
3631 * compareFn(c1: Country, c2: Country): boolean {
3632 * return c1 && c2 ? c1.id === c2.id : c1 === c2;
3633 * }
3634 * ```
3635 *
3636 * **Note:** We listen to the 'change' event because 'input' events aren't fired
3637 * for selects in IE, see:
3638 * https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event#browser_compatibility
3639 *
3640 * @ngModule ReactiveFormsModule
3641 * @ngModule FormsModule
3642 * @publicApi
3643 */
3644export declare class SelectControlValueAccessor extends ɵangular_packages_forms_forms_g implements ControlValueAccessor {
3645 /** @nodoc */
3646 value: any;
3647 /**
3648 * @description
3649 * Tracks the option comparison algorithm for tracking identities when
3650 * checking for changes.
3651 */
3652 set compareWith(fn: (o1: any, o2: any) => boolean);
3653 private _compareWith;
3654 /**
3655 * Sets the "value" property on the input element. The "selectedIndex"
3656 * property is also set if an ID is provided on the option element.
3657 * @nodoc
3658 */
3659 writeValue(value: any): void;
3660 /**
3661 * Registers a function called when the control value changes.
3662 * @nodoc
3663 */
3664 registerOnChange(fn: (value: any) => any): void;
3665}
3666
3667/**
3668 * @description
3669 * The `ControlValueAccessor` for writing multi-select control values and listening to multi-select
3670 * control changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and
3671 * `NgModel` directives.
3672 *
3673 * @see `SelectControlValueAccessor`
3674 *
3675 * @usageNotes
3676 *
3677 * ### Using a multi-select control
3678 *
3679 * The follow example shows you how to use a multi-select control with a reactive form.
3680 *
3681 * ```ts
3682 * const countryControl = new FormControl();
3683 * ```
3684 *
3685 * ```
3686 * <select multiple name="countries" [formControl]="countryControl">
3687 * <option *ngFor="let country of countries" [ngValue]="country">
3688 * {{ country.name }}
3689 * </option>
3690 * </select>
3691 * ```
3692 *
3693 * ### Customizing option selection
3694 *
3695 * To customize the default option comparison algorithm, `<select>` supports `compareWith` input.
3696 * See the `SelectControlValueAccessor` for usage.
3697 *
3698 * @ngModule ReactiveFormsModule
3699 * @ngModule FormsModule
3700 * @publicApi
3701 */
3702export declare class SelectMultipleControlValueAccessor extends ɵangular_packages_forms_forms_g implements ControlValueAccessor {
3703 /**
3704 * The current value.
3705 * @nodoc
3706 */
3707 value: any;
3708 /**
3709 * @description
3710 * Tracks the option comparison algorithm for tracking identities when
3711 * checking for changes.
3712 */
3713 set compareWith(fn: (o1: any, o2: any) => boolean);
3714 private _compareWith;
3715 /**
3716 * Sets the "value" property on one or of more of the select's options.
3717 * @nodoc
3718 */
3719 writeValue(value: any): void;
3720 /**
3721 * Registers a function called when the control value changes
3722 * and writes an array of the selected options.
3723 * @nodoc
3724 */
3725 registerOnChange(fn: (value: any) => any): void;
3726}
3727
3728/**
3729 * @description
3730 * Defines the map of errors returned from failed validation checks.
3731 *
3732 * @publicApi
3733 */
3734export declare type ValidationErrors = {
3735 [key: string]: any;
3736};
3737
3738/**
3739 * @description
3740 * An interface implemented by classes that perform synchronous validation.
3741 *
3742 * @usageNotes
3743 *
3744 * ### Provide a custom validator
3745 *
3746 * The following example implements the `Validator` interface to create a
3747 * validator directive with a custom error key.
3748 *
3749 * ```typescript
3750 * @Directive({
3751 * selector: '[customValidator]',
3752 * providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}]
3753 * })
3754 * class CustomValidatorDirective implements Validator {
3755 * validate(control: AbstractControl): ValidationErrors|null {
3756 * return {'custom': true};
3757 * }
3758 * }
3759 * ```
3760 *
3761 * @publicApi
3762 */
3763export declare interface Validator {
3764 /**
3765 * @description
3766 * Method that performs synchronous validation against the provided control.
3767 *
3768 * @param control The control to validate against.
3769 *
3770 * @returns A map of validation errors if validation fails,
3771 * otherwise null.
3772 */
3773 validate(control: AbstractControl): ValidationErrors | null;
3774 /**
3775 * @description
3776 * Registers a callback function to call when the validator inputs change.
3777 *
3778 * @param fn The callback function
3779 */
3780 registerOnValidatorChange?(fn: () => void): void;
3781}
3782
3783/**
3784 * @description
3785 * A function that receives a control and synchronously returns a map of
3786 * validation errors if present, otherwise null.
3787 *
3788 * @publicApi
3789 */
3790export declare interface ValidatorFn {
3791 (control: AbstractControl): ValidationErrors | null;
3792}
3793
3794/**
3795 * @description
3796 * Provides a set of built-in validators that can be used by form controls.
3797 *
3798 * A validator is a function that processes a `FormControl` or collection of
3799 * controls and returns an error map or null. A null map means that validation has passed.
3800 *
3801 * @see [Form Validation](/guide/form-validation)
3802 *
3803 * @publicApi
3804 */
3805export declare class Validators {
3806 /**
3807 * @description
3808 * Validator that requires the control's value to be greater than or equal to the provided number.
3809 *
3810 * @usageNotes
3811 *
3812 * ### Validate against a minimum of 3
3813 *
3814 * ```typescript
3815 * const control = new FormControl(2, Validators.min(3));
3816 *
3817 * console.log(control.errors); // {min: {min: 3, actual: 2}}
3818 * ```
3819 *
3820 * @returns A validator function that returns an error map with the
3821 * `min` property if the validation check fails, otherwise `null`.
3822 *
3823 * @see `updateValueAndValidity()`
3824 *
3825 */
3826 static min(min: number): ValidatorFn;
3827 /**
3828 * @description
3829 * Validator that requires the control's value to be less than or equal to the provided number.
3830 *
3831 * @usageNotes
3832 *
3833 * ### Validate against a maximum of 15
3834 *
3835 * ```typescript
3836 * const control = new FormControl(16, Validators.max(15));
3837 *
3838 * console.log(control.errors); // {max: {max: 15, actual: 16}}
3839 * ```
3840 *
3841 * @returns A validator function that returns an error map with the
3842 * `max` property if the validation check fails, otherwise `null`.
3843 *
3844 * @see `updateValueAndValidity()`
3845 *
3846 */
3847 static max(max: number): ValidatorFn;
3848 /**
3849 * @description
3850 * Validator that requires the control have a non-empty value.
3851 *
3852 * @usageNotes
3853 *
3854 * ### Validate that the field is non-empty
3855 *
3856 * ```typescript
3857 * const control = new FormControl('', Validators.required);
3858 *
3859 * console.log(control.errors); // {required: true}
3860 * ```
3861 *
3862 * @returns An error map with the `required` property
3863 * if the validation check fails, otherwise `null`.
3864 *
3865 * @see `updateValueAndValidity()`
3866 *
3867 */
3868 static required(control: AbstractControl): ValidationErrors | null;
3869 /**
3870 * @description
3871 * Validator that requires the control's value be true. This validator is commonly
3872 * used for required checkboxes.
3873 *
3874 * @usageNotes
3875 *
3876 * ### Validate that the field value is true
3877 *
3878 * ```typescript
3879 * const control = new FormControl('', Validators.requiredTrue);
3880 *
3881 * console.log(control.errors); // {required: true}
3882 * ```
3883 *
3884 * @returns An error map that contains the `required` property
3885 * set to `true` if the validation check fails, otherwise `null`.
3886 *
3887 * @see `updateValueAndValidity()`
3888 *
3889 */
3890 static requiredTrue(control: AbstractControl): ValidationErrors | null;
3891 /**
3892 * @description
3893 * Validator that requires the control's value pass an email validation test.
3894 *
3895 * Tests the value using a [regular
3896 * expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)
3897 * pattern suitable for common usecases. The pattern is based on the definition of a valid email
3898 * address in the [WHATWG HTML
3899 * specification](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address) with
3900 * some enhancements to incorporate more RFC rules (such as rules related to domain names and the
3901 * lengths of different parts of the address).
3902 *
3903 * The differences from the WHATWG version include:
3904 * - Disallow `local-part` (the part before the `@` symbol) to begin or end with a period (`.`).
3905 * - Disallow `local-part` to be longer than 64 characters.
3906 * - Disallow the whole address to be longer than 254 characters.
3907 *
3908 * If this pattern does not satisfy your business needs, you can use `Validators.pattern()` to
3909 * validate the value against a different pattern.
3910 *
3911 * @usageNotes
3912 *
3913 * ### Validate that the field matches a valid email pattern
3914 *
3915 * ```typescript
3916 * const control = new FormControl('bad@', Validators.email);
3917 *
3918 * console.log(control.errors); // {email: true}
3919 * ```
3920 *
3921 * @returns An error map with the `email` property
3922 * if the validation check fails, otherwise `null`.
3923 *
3924 * @see `updateValueAndValidity()`
3925 *
3926 */
3927 static email(control: AbstractControl): ValidationErrors | null;
3928 /**
3929 * @description
3930 * Validator that requires the length of the control's value to be greater than or equal
3931 * to the provided minimum length. This validator is also provided by default if you use the
3932 * the HTML5 `minlength` attribute. Note that the `minLength` validator is intended to be used
3933 * only for types that have a numeric `length` property, such as strings or arrays. The
3934 * `minLength` validator logic is also not invoked for values when their `length` property is 0
3935 * (for example in case of an empty string or an empty array), to support optional controls. You
3936 * can use the standard `required` validator if empty values should not be considered valid.
3937 *
3938 * @usageNotes
3939 *
3940 * ### Validate that the field has a minimum of 3 characters
3941 *
3942 * ```typescript
3943 * const control = new FormControl('ng', Validators.minLength(3));
3944 *
3945 * console.log(control.errors); // {minlength: {requiredLength: 3, actualLength: 2}}
3946 * ```
3947 *
3948 * ```html
3949 * <input minlength="5">
3950 * ```
3951 *
3952 * @returns A validator function that returns an error map with the
3953 * `minlength` property if the validation check fails, otherwise `null`.
3954 *
3955 * @see `updateValueAndValidity()`
3956 *
3957 */
3958 static minLength(minLength: number): ValidatorFn;
3959 /**
3960 * @description
3961 * Validator that requires the length of the control's value to be less than or equal
3962 * to the provided maximum length. This validator is also provided by default if you use the
3963 * the HTML5 `maxlength` attribute. Note that the `maxLength` validator is intended to be used
3964 * only for types that have a numeric `length` property, such as strings or arrays.
3965 *
3966 * @usageNotes
3967 *
3968 * ### Validate that the field has maximum of 5 characters
3969 *
3970 * ```typescript
3971 * const control = new FormControl('Angular', Validators.maxLength(5));
3972 *
3973 * console.log(control.errors); // {maxlength: {requiredLength: 5, actualLength: 7}}
3974 * ```
3975 *
3976 * ```html
3977 * <input maxlength="5">
3978 * ```
3979 *
3980 * @returns A validator function that returns an error map with the
3981 * `maxlength` property if the validation check fails, otherwise `null`.
3982 *
3983 * @see `updateValueAndValidity()`
3984 *
3985 */
3986 static maxLength(maxLength: number): ValidatorFn;
3987 /**
3988 * @description
3989 * Validator that requires the control's value to match a regex pattern. This validator is also
3990 * provided by default if you use the HTML5 `pattern` attribute.
3991 *
3992 * @usageNotes
3993 *
3994 * ### Validate that the field only contains letters or spaces
3995 *
3996 * ```typescript
3997 * const control = new FormControl('1', Validators.pattern('[a-zA-Z ]*'));
3998 *
3999 * console.log(control.errors); // {pattern: {requiredPattern: '^[a-zA-Z ]*$', actualValue: '1'}}
4000 * ```
4001 *
4002 * ```html
4003 * <input pattern="[a-zA-Z ]*">
4004 * ```
4005 *
4006 * ### Pattern matching with the global or sticky flag
4007 *
4008 * `RegExp` objects created with the `g` or `y` flags that are passed into `Validators.pattern`
4009 * can produce different results on the same input when validations are run consecutively. This is
4010 * due to how the behavior of `RegExp.prototype.test` is
4011 * specified in [ECMA-262](https://tc39.es/ecma262/#sec-regexpbuiltinexec)
4012 * (`RegExp` preserves the index of the last match when the global or sticky flag is used).
4013 * Due to this behavior, it is recommended that when using
4014 * `Validators.pattern` you **do not** pass in a `RegExp` object with either the global or sticky
4015 * flag enabled.
4016 *
4017 * ```typescript
4018 * // Not recommended (since the `g` flag is used)
4019 * const controlOne = new FormControl('1', Validators.pattern(/foo/g));
4020 *
4021 * // Good
4022 * const controlTwo = new FormControl('1', Validators.pattern(/foo/));
4023 * ```
4024 *
4025 * @param pattern A regular expression to be used as is to test the values, or a string.
4026 * If a string is passed, the `^` character is prepended and the `$` character is
4027 * appended to the provided string (if not already present), and the resulting regular
4028 * expression is used to test the values.
4029 *
4030 * @returns A validator function that returns an error map with the
4031 * `pattern` property if the validation check fails, otherwise `null`.
4032 *
4033 * @see `updateValueAndValidity()`
4034 *
4035 */
4036 static pattern(pattern: string | RegExp): ValidatorFn;
4037 /**
4038 * @description
4039 * Validator that performs no operation.
4040 *
4041 * @see `updateValueAndValidity()`
4042 *
4043 */
4044 static nullValidator(control: AbstractControl): ValidationErrors | null;
4045 /**
4046 * @description
4047 * Compose multiple validators into a single function that returns the union
4048 * of the individual error maps for the provided control.
4049 *
4050 * @returns A validator function that returns an error map with the
4051 * merged error maps of the validators if the validation check fails, otherwise `null`.
4052 *
4053 * @see `updateValueAndValidity()`
4054 *
4055 */
4056 static compose(validators: null): null;
4057 static compose(validators: (ValidatorFn | null | undefined)[]): ValidatorFn | null;
4058 /**
4059 * @description
4060 * Compose multiple async validators into a single function that returns the union
4061 * of the individual error objects for the provided control.
4062 *
4063 * @returns A validator function that returns an error map with the
4064 * merged error objects of the async validators if the validation check fails, otherwise `null`.
4065 *
4066 * @see `updateValueAndValidity()`
4067 *
4068 */
4069 static composeAsync(validators: (AsyncValidatorFn | null)[]): AsyncValidatorFn | null;
4070}
4071
4072/**
4073 * @publicApi
4074 */
4075export declare const VERSION: Version;
4076
4077export declare const ɵangular_packages_forms_forms_a: Type<any>[];
4078
4079export declare const ɵangular_packages_forms_forms_b: Type<any>[];
4080
4081/**
4082 * @description
4083 * Provider which adds `MaxValidator` to the `NG_VALIDATORS` multi-provider list.
4084 */
4085export declare const ɵangular_packages_forms_forms_bc: StaticProvider;
4086
4087/**
4088 * @description
4089 * Provider which adds `MinValidator` to the `NG_VALIDATORS` multi-provider list.
4090 */
4091export declare const ɵangular_packages_forms_forms_bd: StaticProvider;
4092
4093/**
4094 * @description
4095 * Provider which adds `RequiredValidator` to the `NG_VALIDATORS` multi-provider list.
4096 */
4097export declare const ɵangular_packages_forms_forms_be: StaticProvider;
4098
4099/**
4100 * @description
4101 * Provider which adds `CheckboxRequiredValidator` to the `NG_VALIDATORS` multi-provider list.
4102 */
4103export declare const ɵangular_packages_forms_forms_bf: StaticProvider;
4104
4105/**
4106 * @description
4107 * Provider which adds `EmailValidator` to the `NG_VALIDATORS` multi-provider list.
4108 */
4109export declare const ɵangular_packages_forms_forms_bg: any;
4110
4111/**
4112 * @description
4113 * Provider which adds `MinLengthValidator` to the `NG_VALIDATORS` multi-provider list.
4114 */
4115export declare const ɵangular_packages_forms_forms_bh: any;
4116
4117/**
4118 * @description
4119 * Provider which adds `MaxLengthValidator` to the `NG_VALIDATORS` multi-provider list.
4120 */
4121export declare const ɵangular_packages_forms_forms_bi: any;
4122
4123/**
4124 * @description
4125 * Provider which adds `PatternValidator` to the `NG_VALIDATORS` multi-provider list.
4126 */
4127export declare const ɵangular_packages_forms_forms_bj: any;
4128
4129/**
4130 * Validator that requires the control's value to be greater than or equal to the provided number.
4131 * See `Validators.min` for additional information.
4132 */
4133export declare function ɵangular_packages_forms_forms_bk(min: number): ValidatorFn;
4134
4135/**
4136 * Validator that requires the control's value to be less than or equal to the provided number.
4137 * See `Validators.max` for additional information.
4138 */
4139export declare function ɵangular_packages_forms_forms_bl(max: number): ValidatorFn;
4140
4141/**
4142 * Validator that requires the control have a non-empty value.
4143 * See `Validators.required` for additional information.
4144 */
4145export declare function ɵangular_packages_forms_forms_bm(control: AbstractControl): ValidationErrors | null;
4146
4147/**
4148 * Validator that requires the control's value be true. This validator is commonly
4149 * used for required checkboxes.
4150 * See `Validators.requiredTrue` for additional information.
4151 */
4152export declare function ɵangular_packages_forms_forms_bn(control: AbstractControl): ValidationErrors | null;
4153
4154/**
4155 * Validator that requires the control's value pass an email validation test.
4156 * See `Validators.email` for additional information.
4157 */
4158export declare function ɵangular_packages_forms_forms_bo(control: AbstractControl): ValidationErrors | null;
4159
4160/**
4161 * Validator that requires the length of the control's value to be greater than or equal
4162 * to the provided minimum length. See `Validators.minLength` for additional information.
4163 */
4164export declare function ɵangular_packages_forms_forms_bp(minLength: number): ValidatorFn;
4165
4166/**
4167 * Validator that requires the length of the control's value to be less than or equal
4168 * to the provided maximum length. See `Validators.maxLength` for additional information.
4169 */
4170export declare function ɵangular_packages_forms_forms_bq(maxLength: number): ValidatorFn;
4171
4172/**
4173 * Validator that requires the control's value to match a regex pattern.
4174 * See `Validators.pattern` for additional information.
4175 */
4176export declare function ɵangular_packages_forms_forms_br(pattern: string | RegExp): ValidatorFn;
4177
4178/**
4179 * Function that has `ValidatorFn` shape, but performs no operation.
4180 */
4181export declare function ɵangular_packages_forms_forms_bs(control: AbstractControl): ValidationErrors | null;
4182
4183export declare const ɵangular_packages_forms_forms_c: Type<any>[];
4184
4185export declare const ɵangular_packages_forms_forms_e: any;
4186
4187/**
4188 * Base class for all ControlValueAccessor classes defined in Forms package.
4189 * Contains common logic and utility functions.
4190 *
4191 * Note: this is an *internal-only* class and should not be extended or used directly in
4192 * applications code.
4193 */
4194export declare class ɵangular_packages_forms_forms_f {
4195 private _renderer;
4196 private _elementRef;
4197 /**
4198 * The registered callback function called when a change or input event occurs on the input
4199 * element.
4200 * @nodoc
4201 */
4202 onChange: (_: any) => void;
4203 /**
4204 * The registered callback function called when a blur event occurs on the input element.
4205 * @nodoc
4206 */
4207 onTouched: () => void;
4208 constructor(_renderer: Renderer2, _elementRef: ElementRef);
4209 /**
4210 * Helper method that sets a property on a target element using the current Renderer
4211 * implementation.
4212 * @nodoc
4213 */
4214 protected setProperty(key: string, value: any): void;
4215 /**
4216 * Registers a function called when the control is touched.
4217 * @nodoc
4218 */
4219 registerOnTouched(fn: () => void): void;
4220 /**
4221 * Registers a function called when the control value changes.
4222 * @nodoc
4223 */
4224 registerOnChange(fn: (_: any) => {}): void;
4225 /**
4226 * Sets the "disabled" property on the range input element.
4227 * @nodoc
4228 */
4229 setDisabledState(isDisabled: boolean): void;
4230}
4231
4232/**
4233 * Base class for all built-in ControlValueAccessor classes (except DefaultValueAccessor, which is
4234 * used in case no other CVAs can be found). We use this class to distinguish between default CVA,
4235 * built-in CVAs and custom CVAs, so that Forms logic can recognize built-in CVAs and treat custom
4236 * ones with higher priority (when both built-in and custom CVAs are present).
4237 *
4238 * Note: this is an *internal-only* class and should not be extended or used directly in
4239 * applications code.
4240 */
4241export declare class ɵangular_packages_forms_forms_g extends ɵangular_packages_forms_forms_f {
4242}
4243
4244export declare const ɵangular_packages_forms_forms_h: any;
4245
4246export declare class ɵangular_packages_forms_forms_i {
4247 private _cd;
4248 constructor(cd: AbstractControlDirective | null);
4249 is(status: AnyControlStatus): boolean;
4250}
4251
4252export declare const ɵangular_packages_forms_forms_j: {
4253 '[class.ng-untouched]': string;
4254 '[class.ng-touched]': string;
4255 '[class.ng-pristine]': string;
4256 '[class.ng-dirty]': string;
4257 '[class.ng-valid]': string;
4258 '[class.ng-invalid]': string;
4259 '[class.ng-pending]': string;
4260};
4261
4262export declare const ɵangular_packages_forms_forms_k: any;
4263
4264export declare const ɵangular_packages_forms_forms_l: any;
4265
4266export declare const ɵangular_packages_forms_forms_m: any;
4267
4268export declare const ɵangular_packages_forms_forms_n: any;
4269
4270export declare const ɵangular_packages_forms_forms_o: any;
4271
4272/**
4273 * Internal-only NgModule that works as a host for the `RadioControlRegistry` tree-shakable
4274 * provider. Note: the `InternalFormsSharedModule` can not be used here directly, since it's
4275 * declared *after* the `RadioControlRegistry` class and the `providedIn` doesn't support
4276 * `forwardRef` logic.
4277 */
4278export declare class ɵangular_packages_forms_forms_p {
4279}
4280
4281/**
4282 * @description
4283 * Class used by Angular to track radio buttons. For internal use only.
4284 */
4285export declare class ɵangular_packages_forms_forms_q {
4286 private _accessors;
4287 /**
4288 * @description
4289 * Adds a control to the internal registry. For internal use only.
4290 */
4291 add(control: NgControl, accessor: RadioControlValueAccessor): void;
4292 /**
4293 * @description
4294 * Removes a control from the internal registry. For internal use only.
4295 */
4296 remove(accessor: RadioControlValueAccessor): void;
4297 /**
4298 * @description
4299 * Selects a radio button. For internal use only.
4300 */
4301 select(accessor: RadioControlValueAccessor): void;
4302 private _isSameGroup;
4303}
4304
4305export declare const ɵangular_packages_forms_forms_r: StaticProvider;
4306
4307/**
4308 * Token to provide to turn off the ngModel warning on formControl and formControlName.
4309 */
4310export declare const ɵangular_packages_forms_forms_s: InjectionToken<unknown>;
4311
4312export declare const ɵangular_packages_forms_forms_t: any;
4313
4314export declare const ɵangular_packages_forms_forms_u: any;
4315
4316export declare const ɵangular_packages_forms_forms_v: any;
4317
4318export declare const ɵangular_packages_forms_forms_w: any;
4319
4320export declare const ɵangular_packages_forms_forms_x: any;
4321
4322export declare const ɵangular_packages_forms_forms_y: StaticProvider;
4323
4324export declare const ɵangular_packages_forms_forms_z: StaticProvider;
4325
4326/**
4327 * Internal module used for sharing directives between FormsModule and ReactiveFormsModule
4328 */
4329declare class ɵInternalFormsSharedModule {
4330}
4331export { ɵInternalFormsSharedModule }
4332export { ɵInternalFormsSharedModule as ɵangular_packages_forms_forms_d }
4333
4334
4335/**
4336 * @description
4337 *
4338 * Adds `novalidate` attribute to all forms by default.
4339 *
4340 * `novalidate` is used to disable browser's native form validation.
4341 *
4342 * If you want to use native validation with Angular forms, just add `ngNativeValidate` attribute:
4343 *
4344 * ```
4345 * <form ngNativeValidate></form>
4346 * ```
4347 *
4348 * @publicApi
4349 * @ngModule ReactiveFormsModule
4350 * @ngModule FormsModule
4351 */
4352declare class ɵNgNoValidate {
4353}
4354export { ɵNgNoValidate }
4355export { ɵNgNoValidate as ɵangular_packages_forms_forms_bb }
4356
4357/**
4358 * @description
4359 * Marks `<option>` as dynamic, so Angular can be notified when options change.
4360 *
4361 * @see `SelectMultipleControlValueAccessor`
4362 *
4363 * @ngModule ReactiveFormsModule
4364 * @ngModule FormsModule
4365 * @publicApi
4366 */
4367declare class ɵNgSelectMultipleOption implements OnDestroy {
4368 private _element;
4369 private _renderer;
4370 private _select;
4371 id: string;
4372 constructor(_element: ElementRef, _renderer: Renderer2, _select: SelectMultipleControlValueAccessor);
4373 /**
4374 * @description
4375 * Tracks the value bound to the option element. Unlike the value binding,
4376 * ngValue supports binding to objects.
4377 */
4378 set ngValue(value: any);
4379 /**
4380 * @description
4381 * Tracks simple string values bound to the option element.
4382 * For objects, use the `ngValue` input binding.
4383 */
4384 set value(value: any);
4385 /** @nodoc */
4386 ngOnDestroy(): void;
4387}
4388export { ɵNgSelectMultipleOption }
4389export { ɵNgSelectMultipleOption as ɵangular_packages_forms_forms_ba }
4390
4391export { }
4392
\No newline at end of file