source: trip-planner-front/node_modules/@angular/forms/forms.d.ts@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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