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