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