(0, minValidator);
2768 | * expect(ctrl.hasValidator(minValidator)).toEqual(true)
2769 | * expect(ctrl.hasValidator(Validators.min(3))).toEqual(false)
2770 | * ```
2771 | *
2772 | * @param validator The validator to check for presence. Compared by function reference.
2773 | * @returns Whether the provided validator was found on this control.
2774 | */
2775 | hasValidator(validator: ValidatorFn): boolean;
2776 | /**
2777 | * Check whether an asynchronous validator function is present on this control. The provided
2778 | * validator must be a reference to the exact same function that was provided.
2779 | *
2780 | * @param validator The asynchronous validator to check for presence. Compared by function
2781 | * reference.
2782 | * @returns Whether the provided asynchronous validator was found on this control.
2783 | */
2784 | hasAsyncValidator(validator: AsyncValidatorFn): boolean;
2785 | /**
2786 | * Empties out the synchronous validator list.
2787 | *
2788 | * When you add or remove a validator at run time, you must call
2789 | * `updateValueAndValidity()` for the new validation to take effect.
2790 | *
2791 | */
2792 | clearValidators(): void;
2793 | /**
2794 | * Empties out the async validator list.
2795 | *
2796 | * When you add or remove a validator at run time, you must call
2797 | * `updateValueAndValidity()` for the new validation to take effect.
2798 | *
2799 | */
2800 | clearAsyncValidators(): void;
2801 | /**
2802 | * Marks the control as `touched`. A control is touched by focus and
2803 | * blur events that do not change the value.
2804 | *
2805 | * @see {@link markAsUntouched()}
2806 | * @see {@link markAsDirty()}
2807 | * @see {@link markAsPristine()}
2808 | *
2809 | * @param opts Configuration options that determine how the control propagates changes
2810 | * and emits events after marking is applied.
2811 | * * `onlySelf`: When true, mark only this control. When false or not supplied,
2812 | * marks all direct ancestors. Default is false.
2813 | * * `emitEvent`: When true or not supplied (the default), the `events`
2814 | * observable emits a `TouchedChangeEvent` with the `touched` property being `true`.
2815 | * When false, no events are emitted.
2816 | */
2817 | markAsTouched(opts?: {
2818 | onlySelf?: boolean;
2819 | emitEvent?: boolean;
2820 | }): void;
2821 | /**
2822 | * Marks the control and all its descendant controls as `dirty`.
2823 | * @see {@link markAsDirty()}
2824 | *
2825 | * @param opts Configuration options that determine how the control propagates changes
2826 | * and emits events after marking is applied.
2827 | * * `emitEvent`: When true or not supplied (the default), the `events`
2828 | * observable emits a `PristineChangeEvent` with the `pristine` property being `false`.
2829 | * When false, no events are emitted.
2830 | */
2831 | markAllAsDirty(opts?: {
2832 | emitEvent?: boolean;
2833 | }): void;
2834 | /**
2835 | * Marks the control and all its descendant controls as `touched`.
2836 | * @see {@link markAsTouched()}
2837 | *
2838 | * @param opts Configuration options that determine how the control propagates changes
2839 | * and emits events after marking is applied.
2840 | * * `emitEvent`: When true or not supplied (the default), the `events`
2841 | * observable emits a `TouchedChangeEvent` with the `touched` property being `true`.
2842 | * When false, no events are emitted.
2843 | */
2844 | markAllAsTouched(opts?: {
2845 | emitEvent?: boolean;
2846 | }): void;
2847 | /**
2848 | * Marks the control as `untouched`.
2849 | *
2850 | * If the control has any children, also marks all children as `untouched`
2851 | * and recalculates the `touched` status of all parent controls.
2852 | *
2853 | * @see {@link markAsTouched()}
2854 | * @see {@link markAsDirty()}
2855 | * @see {@link markAsPristine()}
2856 | *
2857 | * @param opts Configuration options that determine how the control propagates changes
2858 | * and emits events after the marking is applied.
2859 | * * `onlySelf`: When true, mark only this control. When false or not supplied,
2860 | * marks all direct ancestors. Default is false.
2861 | * * `emitEvent`: When true or not supplied (the default), the `events`
2862 | * observable emits a `TouchedChangeEvent` with the `touched` property being `false`.
2863 | * When false, no events are emitted.
2864 | */
2865 | markAsUntouched(opts?: {
2866 | onlySelf?: boolean;
2867 | emitEvent?: boolean;
2868 | }): void;
2869 | /**
2870 | * Marks the control as `dirty`. A control becomes dirty when
2871 | * the control's value is changed through the UI; compare `markAsTouched`.
2872 | *
2873 | * @see {@link markAsTouched()}
2874 | * @see {@link markAsUntouched()}
2875 | * @see {@link markAsPristine()}
2876 | *
2877 | * @param opts Configuration options that determine how the control propagates changes
2878 | * and emits events after marking is applied.
2879 | * * `onlySelf`: When true, mark only this control. When false or not supplied,
2880 | * marks all direct ancestors. Default is false.
2881 | * * `emitEvent`: When true or not supplied (the default), the `events`
2882 | * observable emits a `PristineChangeEvent` with the `pristine` property being `false`.
2883 | * When false, no events are emitted.
2884 | */
2885 | markAsDirty(opts?: {
2886 | onlySelf?: boolean;
2887 | emitEvent?: boolean;
2888 | }): void;
2889 | /**
2890 | * Marks the control as `pristine`.
2891 | *
2892 | * If the control has any children, marks all children as `pristine`,
2893 | * and recalculates the `pristine` status of all parent
2894 | * controls.
2895 | *
2896 | * @see {@link markAsTouched()}
2897 | * @see {@link markAsUntouched()}
2898 | * @see {@link markAsDirty()}
2899 | *
2900 | * @param opts Configuration options that determine how the control emits events after
2901 | * marking is applied.
2902 | * * `onlySelf`: When true, mark only this control. When false or not supplied,
2903 | * marks all direct ancestors. Default is false.
2904 | * * `emitEvent`: When true or not supplied (the default), the `events`
2905 | * observable emits a `PristineChangeEvent` with the `pristine` property being `true`.
2906 | * When false, no events are emitted.
2907 | */
2908 | markAsPristine(opts?: {
2909 | onlySelf?: boolean;
2910 | emitEvent?: boolean;
2911 | }): void;
2912 | /**
2913 | * Marks the control as `pending`.
2914 | *
2915 | * A control is pending while the control performs async validation.
2916 | *
2917 | * @see {@link AbstractControl.status}
2918 | *
2919 | * @param opts Configuration options that determine how the control propagates changes and
2920 | * emits events after marking is applied.
2921 | * * `onlySelf`: When true, mark only this control. When false or not supplied,
2922 | * marks all direct ancestors. Default is false.
2923 | * * `emitEvent`: When true or not supplied (the default), the `statusChanges`
2924 | * observable emits an event with the latest status the control is marked pending
2925 | * and the `events` observable emits a `StatusChangeEvent` with the `status` property being
2926 | * `PENDING` When false, no events are emitted.
2927 | *
2928 | */
2929 | markAsPending(opts?: {
2930 | onlySelf?: boolean;
2931 | emitEvent?: boolean;
2932 | }): void;
2933 | /**
2934 | * Disables the control. This means the control is exempt from validation checks and
2935 | * excluded from the aggregate value of any parent. Its status is `DISABLED`.
2936 | *
2937 | * If the control has children, all children are also disabled.
2938 | *
2939 | * @see {@link AbstractControl.status}
2940 | *
2941 | * @param opts Configuration options that determine how the control propagates
2942 | * changes and emits events after the control is disabled.
2943 | * * `onlySelf`: When true, mark only this control. When false or not supplied,
2944 | * marks all direct ancestors. Default is false.
2945 | * * `emitEvent`: When true or not supplied (the default), the `statusChanges`,
2946 | * `valueChanges` and `events`
2947 | * observables emit events with the latest status and value when the control is disabled.
2948 | * When false, no events are emitted.
2949 | */
2950 | disable(opts?: {
2951 | onlySelf?: boolean;
2952 | emitEvent?: boolean;
2953 | }): void;
2954 | /**
2955 | * Enables the control. This means the control is included in validation checks and
2956 | * the aggregate value of its parent. Its status recalculates based on its value and
2957 | * its validators.
2958 | *
2959 | * By default, if the control has children, all children are enabled.
2960 | *
2961 | * @see {@link AbstractControl.status}
2962 | *
2963 | * @param opts Configure options that control how the control propagates changes and
2964 | * emits events when marked as untouched
2965 | * * `onlySelf`: When true, mark only this control. When false or not supplied,
2966 | * marks all direct ancestors. Default is false.
2967 | * * `emitEvent`: When true or not supplied (the default), the `statusChanges`,
2968 | * `valueChanges` and `events`
2969 | * observables emit events with the latest status and value when the control is enabled.
2970 | * When false, no events are emitted.
2971 | */
2972 | enable(opts?: {
2973 | onlySelf?: boolean;
2974 | emitEvent?: boolean;
2975 | }): void;
2976 | private _updateAncestors;
2977 | /**
2978 | * Sets the parent of the control
2979 | *
2980 | * @param parent The new parent.
2981 | */
2982 | setParent(parent: FormGroup | FormArray | null): void;
2983 | /**
2984 | * Sets the value of the control. Abstract method (implemented in sub-classes).
2985 | */
2986 | abstract setValue(value: TRawValue, options?: Object): void;
2987 | /**
2988 | * Patches the value of the control. Abstract method (implemented in sub-classes).
2989 | */
2990 | abstract patchValue(value: TValue, options?: Object): void;
2991 | /**
2992 | * Resets the control. Abstract method (implemented in sub-classes).
2993 | */
2994 | abstract reset(value?: TValueWithOptionalControlStates, options?: Object): void;
2995 | /**
2996 | * The raw value of this control. For most control implementations, the raw value will include
2997 | * disabled children.
2998 | */
2999 | getRawValue(): any;
3000 | /**
3001 | * Recalculates the value and validation status of the control.
3002 | *
3003 | * By default, it also updates the value and validity of its ancestors.
3004 | *
3005 | * @param opts Configuration options determine how the control propagates changes and emits events
3006 | * after updates and validity checks are applied.
3007 | * * `onlySelf`: When true, only update this control. When false or not supplied,
3008 | * update all direct ancestors. Default is false.
3009 | * * `emitEvent`: When true or not supplied (the default), the `statusChanges`,
3010 | * `valueChanges` and `events`
3011 | * observables emit events with the latest status and value when the control is updated.
3012 | * When false, no events are emitted.
3013 | */
3014 | updateValueAndValidity(opts?: {
3015 | onlySelf?: boolean;
3016 | emitEvent?: boolean;
3017 | }): void;
3018 | private _setInitialStatus;
3019 | private _runValidator;
3020 | private _runAsyncValidator;
3021 | private _cancelExistingSubscription;
3022 | /**
3023 | * Sets errors on a form control when running validations manually, rather than automatically.
3024 | *
3025 | * Calling `setErrors` also updates the validity of the parent control.
3026 | *
3027 | * @param opts Configuration options that determine how the control propagates
3028 | * changes and emits events after the control errors are set.
3029 | * * `emitEvent`: When true or not supplied (the default), the `statusChanges`
3030 | * observable emits an event after the errors are set.
3031 | *
3032 | * @usageNotes
3033 | *
3034 | * ### Manually set the errors for a control
3035 | *
3036 | * ```ts
3037 | * const login = new FormControl('someLogin');
3038 | * login.setErrors({
3039 | * notUnique: true
3040 | * });
3041 | *
3042 | * expect(login.valid).toEqual(false);
3043 | * expect(login.errors).toEqual({ notUnique: true });
3044 | *
3045 | * login.setValue('someOtherLogin');
3046 | *
3047 | * expect(login.valid).toEqual(true);
3048 | * ```
3049 | */
3050 | setErrors(errors: ValidationErrors | null, opts?: {
3051 | emitEvent?: boolean;
3052 | }): void;
3053 | /**
3054 | * Retrieves a child control given the control's name or path.
3055 | *
3056 | * This signature for get supports strings and `const` arrays (`.get(['foo', 'bar'] as const)`).
3057 | */
3058 | get(path: P): AbstractControl<ɵGetProperty> | null;
3059 | /**
3060 | * Retrieves a child control given the control's name or path.
3061 | *
3062 | * This signature for `get` supports non-const (mutable) arrays. Inferred type
3063 | * information will not be as robust, so prefer to pass a `readonly` array if possible.
3064 | */
3065 | get>(path: P): AbstractControl<ɵGetProperty> | null;
3066 | /**
3067 | * @description
3068 | * Reports error data for the control with the given path.
3069 | *
3070 | * @param errorCode The code of the error to check
3071 | * @param path A list of control names that designates how to move from the current control
3072 | * to the control that should be queried for errors.
3073 | *
3074 | * @usageNotes
3075 | * For example, for the following `FormGroup`:
3076 | *
3077 | * ```ts
3078 | * form = new FormGroup({
3079 | * address: new FormGroup({ street: new FormControl() })
3080 | * });
3081 | * ```
3082 | *
3083 | * The path to the 'street' control from the root form would be 'address' -> 'street'.
3084 | *
3085 | * It can be provided to this method in one of two formats:
3086 | *
3087 | * 1. An array of string control names, e.g. `['address', 'street']`
3088 | * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
3089 | *
3090 | * @returns error data for that particular error. If the control or error is not present,
3091 | * null is returned.
3092 | */
3093 | getError(errorCode: string, path?: Array | string): any;
3094 | /**
3095 | * @description
3096 | * Reports whether the control with the given path has the error specified.
3097 | *
3098 | * @param errorCode The code of the error to check
3099 | * @param path A list of control names that designates how to move from the current control
3100 | * to the control that should be queried for errors.
3101 | *
3102 | * @usageNotes
3103 | * For example, for the following `FormGroup`:
3104 | *
3105 | * ```ts
3106 | * form = new FormGroup({
3107 | * address: new FormGroup({ street: new FormControl() })
3108 | * });
3109 | * ```
3110 | *
3111 | * The path to the 'street' control from the root form would be 'address' -> 'street'.
3112 | *
3113 | * It can be provided to this method in one of two formats:
3114 | *
3115 | * 1. An array of string control names, e.g. `['address', 'street']`
3116 | * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
3117 | *
3118 | * If no path is given, this method checks for the error on the current control.
3119 | *
3120 | * @returns whether the given error is present in the control at the given path.
3121 | *
3122 | * If the control is not present, false is returned.
3123 | */
3124 | hasError(errorCode: string, path?: Array | string): boolean;
3125 | /**
3126 | * Retrieves the top-level ancestor of this control.
3127 | */
3128 | get root(): AbstractControl;
3129 | private _calculateStatus;
3130 | /**
3131 | * Internal implementation of the `setValidators` method. Needs to be separated out into a
3132 | * different method, because it is called in the constructor and it can break cases where
3133 | * a control is extended.
3134 | */
3135 | private _assignValidators;
3136 | /**
3137 | * Internal implementation of the `setAsyncValidators` method. Needs to be separated out into a
3138 | * different method, because it is called in the constructor and it can break cases where
3139 | * a control is extended.
3140 | */
3141 | private _assignAsyncValidators;
3142 | }
3143 |
3144 | /**
3145 | * @description
3146 | * Base class for control directives.
3147 | *
3148 | * This class is only used internally in the `ReactiveFormsModule` and the `FormsModule`.
3149 | *
3150 | * @publicApi
3151 | */
3152 | declare abstract class AbstractControlDirective {
3153 | /**
3154 | * @description
3155 | * A reference to the underlying control.
3156 | *
3157 | * @returns the control that backs this directive. Most properties fall through to that instance.
3158 | */
3159 | abstract get control(): AbstractControl | null;
3160 | /**
3161 | * @description
3162 | * Reports the value of the control if it is present, otherwise null.
3163 | */
3164 | get value(): any;
3165 | /**
3166 | * @description
3167 | * Reports whether the control is valid. A control is considered valid if no
3168 | * validation errors exist with the current value.
3169 | * If the control is not present, null is returned.
3170 | */
3171 | get valid(): boolean | null;
3172 | /**
3173 | * @description
3174 | * Reports whether the control is invalid, meaning that an error exists in the input value.
3175 | * If the control is not present, null is returned.
3176 | */
3177 | get invalid(): boolean | null;
3178 | /**
3179 | * @description
3180 | * Reports whether a control is pending, meaning that async validation is occurring and
3181 | * errors are not yet available for the input value. If the control is not present, null is
3182 | * returned.
3183 | */
3184 | get pending(): boolean | null;
3185 | /**
3186 | * @description
3187 | * Reports whether the control is disabled, meaning that the control is disabled
3188 | * in the UI and is exempt from validation checks and excluded from aggregate
3189 | * values of ancestor controls. If the control is not present, null is returned.
3190 | */
3191 | get disabled(): boolean | null;
3192 | /**
3193 | * @description
3194 | * Reports whether the control is enabled, meaning that the control is included in ancestor
3195 | * calculations of validity or value. If the control is not present, null is returned.
3196 | */
3197 | get enabled(): boolean | null;
3198 | /**
3199 | * @description
3200 | * Reports the control's validation errors. If the control is not present, null is returned.
3201 | */
3202 | get errors(): ValidationErrors | null;
3203 | /**
3204 | * @description
3205 | * Reports whether the control is pristine, meaning that the user has not yet changed
3206 | * the value in the UI. If the control is not present, null is returned.
3207 | */
3208 | get pristine(): boolean | null;
3209 | /**
3210 | * @description
3211 | * Reports whether the control is dirty, meaning that the user has changed
3212 | * the value in the UI. If the control is not present, null is returned.
3213 | */
3214 | get dirty(): boolean | null;
3215 | /**
3216 | * @description
3217 | * Reports whether the control is touched, meaning that the user has triggered
3218 | * a `blur` event on it. If the control is not present, null is returned.
3219 | */
3220 | get touched(): boolean | null;
3221 | /**
3222 | * @description
3223 | * Reports the validation status of the control. Possible values include:
3224 | * 'VALID', 'INVALID', 'DISABLED', and 'PENDING'.
3225 | * If the control is not present, null is returned.
3226 | */
3227 | get status(): string | null;
3228 | /**
3229 | * @description
3230 | * Reports whether the control is untouched, meaning that the user has not yet triggered
3231 | * a `blur` event on it. If the control is not present, null is returned.
3232 | */
3233 | get untouched(): boolean | null;
3234 | /**
3235 | * @description
3236 | * Returns a multicasting observable that emits a validation status whenever it is
3237 | * calculated for the control. If the control is not present, null is returned.
3238 | */
3239 | get statusChanges(): Observable | null;
3240 | /**
3241 | * @description
3242 | * Returns a multicasting observable of value changes for the control that emits every time the
3243 | * value of the control changes in the UI or programmatically.
3244 | * If the control is not present, null is returned.
3245 | */
3246 | get valueChanges(): Observable | null;
3247 | /**
3248 | * @description
3249 | * Returns an array that represents the path from the top-level form to this control.
3250 | * Each index is the string name of the control on that level.
3251 | */
3252 | get path(): string[] | null;
3253 | /**
3254 | * Contains the result of merging synchronous validators into a single validator function
3255 | * (combined using `Validators.compose`).
3256 | */
3257 | private _composedValidatorFn;
3258 | /**
3259 | * Contains the result of merging asynchronous validators into a single validator function
3260 | * (combined using `Validators.composeAsync`).
3261 | */
3262 | private _composedAsyncValidatorFn;
3263 | /**
3264 | * @description
3265 | * Synchronous validator function composed of all the synchronous validators registered with this
3266 | * directive.
3267 | */
3268 | get validator(): ValidatorFn | null;
3269 | /**
3270 | * @description
3271 | * Asynchronous validator function composed of all the asynchronous validators registered with
3272 | * this directive.
3273 | */
3274 | get asyncValidator(): AsyncValidatorFn | null;
3275 | private _onDestroyCallbacks;
3276 | /**
3277 | * @description
3278 | * Resets the control with the provided value if the control is present.
3279 | */
3280 | reset(value?: any): void;
3281 | /**
3282 | * @description
3283 | * Reports whether the control with the given path has the error specified.
3284 | *
3285 | * @param errorCode The code of the error to check
3286 | * @param path A list of control names that designates how to move from the current control
3287 | * to the control that should be queried for errors.
3288 | *
3289 | * @usageNotes
3290 | * For example, for the following `FormGroup`:
3291 | *
3292 | * ```ts
3293 | * form = new FormGroup({
3294 | * address: new FormGroup({ street: new FormControl() })
3295 | * });
3296 | * ```
3297 | *
3298 | * The path to the 'street' control from the root form would be 'address' -> 'street'.
3299 | *
3300 | * It can be provided to this method in one of two formats:
3301 | *
3302 | * 1. An array of string control names, e.g. `['address', 'street']`
3303 | * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
3304 | *
3305 | * If no path is given, this method checks for the error on the current control.
3306 | *
3307 | * @returns whether the given error is present in the control at the given path.
3308 | *
3309 | * If the control is not present, false is returned.
3310 | */
3311 | hasError(errorCode: string, path?: Array | string): boolean;
3312 | /**
3313 | * @description
3314 | * Reports error data for the control with the given path.
3315 | *
3316 | * @param errorCode The code of the error to check
3317 | * @param path A list of control names that designates how to move from the current control
3318 | * to the control that should be queried for errors.
3319 | *
3320 | * @usageNotes
3321 | * For example, for the following `FormGroup`:
3322 | *
3323 | * ```ts
3324 | * form = new FormGroup({
3325 | * address: new FormGroup({ street: new FormControl() })
3326 | * });
3327 | * ```
3328 | *
3329 | * The path to the 'street' control from the root form would be 'address' -> 'street'.
3330 | *
3331 | * It can be provided to this method in one of two formats:
3332 | *
3333 | * 1. An array of string control names, e.g. `['address', 'street']`
3334 | * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
3335 | *
3336 | * @returns error data for that particular error. If the control or error is not present,
3337 | * null is returned.
3338 | */
3339 | getError(errorCode: string, path?: Array | string): any;
3340 | }
3341 |
3342 | /**
3343 | * @description
3344 | * A base class that all `FormControl`-based directives extend. It binds a `FormControl`
3345 | * object to a DOM element.
3346 | *
3347 | * @publicApi
3348 | */
3349 | declare abstract class NgControl extends AbstractControlDirective {
3350 | /**
3351 | * @description
3352 | * The name for the control
3353 | */
3354 | name: string | number | null;
3355 | /**
3356 | * @description
3357 | * The value accessor for the control
3358 | */
3359 | valueAccessor: ControlValueAccessor | null;
3360 | /**
3361 | * @description
3362 | * The callback method to update the model from the view when requested
3363 | *
3364 | * @param newValue The new value for the view
3365 | */
3366 | abstract viewToModelUpdate(newValue: any): void;
3367 | }
3368 |
3369 | /**
3370 | * @description
3371 | * Class used by Angular to track radio buttons. For internal use only.
3372 | */
3373 | declare class RadioControlRegistry {
3374 | private _accessors;
3375 | /**
3376 | * @description
3377 | * Adds a control to the internal registry. For internal use only.
3378 | */
3379 | add(control: NgControl, accessor: RadioControlValueAccessor): void;
3380 | /**
3381 | * @description
3382 | * Removes a control from the internal registry. For internal use only.
3383 | */
3384 | remove(accessor: RadioControlValueAccessor): void;
3385 | /**
3386 | * @description
3387 | * Selects a radio button. For internal use only.
3388 | */
3389 | select(accessor: RadioControlValueAccessor): void;
3390 | private _isSameGroup;
3391 | static ɵfac: i0.ɵɵFactoryDeclaration;
3392 | static ɵprov: i0.ɵɵInjectableDeclaration;
3393 | }
3394 | /**
3395 | * @description
3396 | * The `ControlValueAccessor` for writing radio control values and listening to radio control
3397 | * changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and
3398 | * `NgModel` directives.
3399 | *
3400 | * @usageNotes
3401 | *
3402 | * ### Using radio buttons with reactive form directives
3403 | *
3404 | * The follow example shows how to use radio buttons in a reactive form. When using radio buttons in
3405 | * a reactive form, radio buttons in the same group should have the same `formControlName`.
3406 | * Providing a `name` attribute is optional.
3407 | *
3408 | * {@example forms/ts/reactiveRadioButtons/reactive_radio_button_example.ts region='Reactive'}
3409 | *
3410 | * @ngModule ReactiveFormsModule
3411 | * @ngModule FormsModule
3412 | * @publicApi
3413 | */
3414 | declare class RadioControlValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor, OnDestroy, OnInit {
3415 | private _registry;
3416 | private _injector;
3417 | private setDisabledStateFired;
3418 | /**
3419 | * The registered callback function called when a change event occurs on the input element.
3420 | * Note: we declare `onChange` here (also used as host listener) as a function with no arguments
3421 | * to override the `onChange` function (which expects 1 argument) in the parent
3422 | * `BaseControlValueAccessor` class.
3423 | * @docs-private
3424 | */
3425 | onChange: () => void;
3426 | /**
3427 | * @description
3428 | * Tracks the name of the radio input element.
3429 | */
3430 | name: string;
3431 | /**
3432 | * @description
3433 | * Tracks the name of the `FormControl` bound to the directive. The name corresponds
3434 | * to a key in the parent `FormGroup` or `FormArray`.
3435 | */
3436 | formControlName: string;
3437 | /**
3438 | * @description
3439 | * Tracks the value of the radio input element
3440 | */
3441 | value: any;
3442 | private callSetDisabledState;
3443 | constructor(renderer: Renderer2, elementRef: ElementRef, _registry: RadioControlRegistry, _injector: Injector);
3444 | /** @docs-private */
3445 | ngOnInit(): void;
3446 | /** @docs-private */
3447 | ngOnDestroy(): void;
3448 | /**
3449 | * Sets the "checked" property value on the radio input element.
3450 | * @docs-private
3451 | */
3452 | writeValue(value: any): void;
3453 | /**
3454 | * Registers a function called when the control value changes.
3455 | * @docs-private
3456 | */
3457 | registerOnChange(fn: (_: any) => {}): void;
3458 | /** @docs-private */
3459 | setDisabledState(isDisabled: boolean): void;
3460 | /**
3461 | * Sets the "value" on the radio input element and unchecks it.
3462 | *
3463 | * @param value
3464 | */
3465 | fireUncheck(value: any): void;
3466 | private _checkName;
3467 | static ɵfac: i0.ɵɵFactoryDeclaration;
3468 | static ɵdir: i0.ɵɵDirectiveDeclaration;
3469 | }
3470 |
3471 | /**
3472 | * @description
3473 | * A base class for code shared between the `NgModelGroup` and `FormGroupName` directives.
3474 | *
3475 | * @publicApi
3476 | */
3477 | declare class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy {
3478 | /** @docs-private */
3479 | ngOnInit(): void;
3480 | /** @docs-private */
3481 | ngOnDestroy(): void;
3482 | /**
3483 | * @description
3484 | * The `FormGroup` bound to this directive.
3485 | */
3486 | get control(): FormGroup;
3487 | /**
3488 | * @description
3489 | * The path to this group from the top-level directive.
3490 | */
3491 | get path(): string[];
3492 | /**
3493 | * @description
3494 | * The top-level directive for this group if present, otherwise null.
3495 | */
3496 | get formDirective(): Form | null;
3497 | static ɵfac: i0.ɵɵFactoryDeclaration;
3498 | static ɵdir: i0.ɵɵDirectiveDeclaration;
3499 | }
3500 |
3501 | /**
3502 | * @description
3503 | * An interface implemented by `FormGroupDirective` and `NgForm` directives.
3504 | *
3505 | * Only used by the `ReactiveFormsModule` and `FormsModule`.
3506 | *
3507 | * @publicApi
3508 | */
3509 | interface Form {
3510 | /**
3511 | * @description
3512 | * Add a control to this form.
3513 | *
3514 | * @param dir The control directive to add to the form.
3515 | */
3516 | addControl(dir: NgControl): void;
3517 | /**
3518 | * @description
3519 | * Remove a control from this form.
3520 | *
3521 | * @param dir: The control directive to remove from the form.
3522 | */
3523 | removeControl(dir: NgControl): void;
3524 | /**
3525 | * @description
3526 | * The control directive from which to get the `FormControl`.
3527 | *
3528 | * @param dir: The control directive.
3529 | */
3530 | getControl(dir: NgControl): FormControl;
3531 | /**
3532 | * @description
3533 | * Add a group of controls to this form.
3534 | *
3535 | * @param dir: The control group directive to add.
3536 | */
3537 | addFormGroup(dir: AbstractFormGroupDirective): void;
3538 | /**
3539 | * @description
3540 | * Remove a group of controls to this form.
3541 | *
3542 | * @param dir: The control group directive to remove.
3543 | */
3544 | removeFormGroup(dir: AbstractFormGroupDirective): void;
3545 | /**
3546 | * @description
3547 | * The `FormGroup` associated with a particular `AbstractFormGroupDirective`.
3548 | *
3549 | * @param dir: The form group directive from which to get the `FormGroup`.
3550 | */
3551 | getFormGroup(dir: AbstractFormGroupDirective): FormGroup;
3552 | /**
3553 | * @description
3554 | * Update the model for a particular control with a new value.
3555 | *
3556 | * @param dir: The control directive to update.
3557 | * @param value: The new value for the control.
3558 | */
3559 | updateModel(dir: NgControl, value: any): void;
3560 | }
3561 |
3562 | /**
3563 | * @description
3564 | * A base class for directives that contain multiple registered instances of `NgControl`.
3565 | * Only used by the forms module.
3566 | *
3567 | * @publicApi
3568 | */
3569 | declare abstract class ControlContainer extends AbstractControlDirective {
3570 | /**
3571 | * @description
3572 | * The name for the control
3573 | */
3574 | name: string | number | null;
3575 | /**
3576 | * @description
3577 | * The top-level form directive for the control.
3578 | */
3579 | get formDirective(): Form | null;
3580 | /**
3581 | * @description
3582 | * The path to this group.
3583 | */
3584 | get path(): string[] | null;
3585 | }
3586 |
3587 | declare class AbstractControlStatus {
3588 | private _cd;
3589 | constructor(cd: AbstractControlDirective | null);
3590 | protected get isTouched(): boolean;
3591 | protected get isUntouched(): boolean;
3592 | protected get isPristine(): boolean;
3593 | protected get isDirty(): boolean;
3594 | protected get isValid(): boolean;
3595 | protected get isInvalid(): boolean;
3596 | protected get isPending(): boolean;
3597 | protected get isSubmitted(): boolean;
3598 | }
3599 | /**
3600 | * @description
3601 | * Directive automatically applied to Angular form controls that sets CSS classes
3602 | * based on control status.
3603 | *
3604 | * @usageNotes
3605 | *
3606 | * ### CSS classes applied
3607 | *
3608 | * The following classes are applied as the properties become true:
3609 | *
3610 | * * ng-valid
3611 | * * ng-invalid
3612 | * * ng-pending
3613 | * * ng-pristine
3614 | * * ng-dirty
3615 | * * ng-untouched
3616 | * * ng-touched
3617 | *
3618 | * @ngModule ReactiveFormsModule
3619 | * @ngModule FormsModule
3620 | * @publicApi
3621 | */
3622 | declare class NgControlStatus extends AbstractControlStatus {
3623 | constructor(cd: NgControl);
3624 | static ɵfac: i0.ɵɵFactoryDeclaration;
3625 | static ɵdir: i0.ɵɵDirectiveDeclaration;
3626 | }
3627 | /**
3628 | * @description
3629 | * Directive automatically applied to Angular form groups that sets CSS classes
3630 | * based on control status (valid/invalid/dirty/etc). On groups, this includes the additional
3631 | * class ng-submitted.
3632 | *
3633 | * @see {@link NgControlStatus}
3634 | *
3635 | * @ngModule ReactiveFormsModule
3636 | * @ngModule FormsModule
3637 | * @publicApi
3638 | */
3639 | declare class NgControlStatusGroup extends AbstractControlStatus {
3640 | constructor(cd: ControlContainer);
3641 | static ɵfac: i0.ɵɵFactoryDeclaration;
3642 | static ɵdir: i0.ɵɵDirectiveDeclaration;
3643 | }
3644 |
3645 | /**
3646 | * @description
3647 | * Syncs a `FormControl` in an existing `FormGroup` to a form control
3648 | * element by name.
3649 | *
3650 | * @see [Reactive Forms Guide](guide/forms/reactive-forms)
3651 | * @see {@link FormControl}
3652 | * @see {@link AbstractControl}
3653 | *
3654 | * @usageNotes
3655 | *
3656 | * ### Register `FormControl` within a group
3657 | *
3658 | * The following example shows how to register multiple form controls within a form group
3659 | * and set their value.
3660 | *
3661 | * {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
3662 | *
3663 | * To see `formControlName` examples with different form control types, see:
3664 | *
3665 | * * Radio buttons: `RadioControlValueAccessor`
3666 | * * Selects: `SelectControlValueAccessor`
3667 | *
3668 | * ### Use with ngModel is deprecated
3669 | *
3670 | * Support for using the `ngModel` input property and `ngModelChange` event with reactive
3671 | * form directives has been deprecated in Angular v6 and is scheduled for removal in
3672 | * a future version of Angular.
3673 | *
3674 | * @ngModule ReactiveFormsModule
3675 | * @publicApi
3676 | */
3677 | declare class FormControlName extends NgControl implements OnChanges, OnDestroy {
3678 | private _ngModelWarningConfig;
3679 | private _added;
3680 | /**
3681 | * @description
3682 | * Tracks the `FormControl` instance bound to the directive.
3683 | */
3684 | readonly control: FormControl;
3685 | /**
3686 | * @description
3687 | * Tracks the name of the `FormControl` bound to the directive. The name corresponds
3688 | * to a key in the parent `FormGroup` or `FormArray`.
3689 | * Accepts a name as a string or a number.
3690 | * The name in the form of a string is useful for individual forms,
3691 | * while the numerical form allows for form controls to be bound
3692 | * to indices when iterating over controls in a `FormArray`.
3693 | */
3694 | name: string | number | null;
3695 | /**
3696 | * @description
3697 | * Triggers a warning in dev mode that this input should not be used with reactive forms.
3698 | */
3699 | set isDisabled(isDisabled: boolean);
3700 | /** @deprecated as of v6 */
3701 | model: any;
3702 | /** @deprecated as of v6 */
3703 | update: EventEmitter;
3704 | constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[], _ngModelWarningConfig: string | null);
3705 | /** @docs-private */
3706 | ngOnChanges(changes: SimpleChanges): void;
3707 | /** @docs-private */
3708 | ngOnDestroy(): void;
3709 | /**
3710 | * @description
3711 | * Sets the new value for the view model and emits an `ngModelChange` event.
3712 | *
3713 | * @param newValue The new value for the view model.
3714 | */
3715 | viewToModelUpdate(newValue: any): void;
3716 | /**
3717 | * @description
3718 | * Returns an array that represents the path from the top-level form to this control.
3719 | * Each index is the string name of the control on that level.
3720 | */
3721 | get path(): string[];
3722 | /**
3723 | * @description
3724 | * The top-level directive for this group if present, otherwise null.
3725 | */
3726 | get formDirective(): any;
3727 | private _setUpControl;
3728 | static ɵfac: i0.ɵɵFactoryDeclaration;
3729 | static ɵdir: i0.ɵɵDirectiveDeclaration;
3730 | }
3731 |
3732 | /**
3733 | * @description
3734 | *
3735 | * Binds an existing `FormGroup` or `FormRecord` to a DOM element.
3736 | *
3737 | * This directive accepts an existing `FormGroup` instance. It will then use this
3738 | * `FormGroup` instance to match any child `FormControl`, `FormGroup`/`FormRecord`,
3739 | * and `FormArray` instances to child `FormControlName`, `FormGroupName`,
3740 | * and `FormArrayName` directives.
3741 | *
3742 | * @see [Reactive Forms Guide](guide/forms/reactive-forms)
3743 | * @see {@link AbstractControl}
3744 | *
3745 | * @usageNotes
3746 | * ### Register Form Group
3747 | *
3748 | * The following example registers a `FormGroup` with first name and last name controls,
3749 | * and listens for the *ngSubmit* event when the button is clicked.
3750 | *
3751 | * {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
3752 | *
3753 | * @ngModule ReactiveFormsModule
3754 | * @publicApi
3755 | */
3756 | declare class FormGroupDirective extends ControlContainer implements Form, OnChanges, OnDestroy {
3757 | private callSetDisabledState?;
3758 | /**
3759 | * @description
3760 | * Reports whether the form submission has been triggered.
3761 | */
3762 | get submitted(): boolean;
3763 | private set submitted(value);
3764 | private readonly _submittedReactive;
3765 | /**
3766 | * Reference to an old form group input value, which is needed to cleanup
3767 | * old instance in case it was replaced with a new one.
3768 | */
3769 | private _oldForm;
3770 | /**
3771 | * Callback that should be invoked when controls in FormGroup or FormArray collection change
3772 | * (added or removed). This callback triggers corresponding DOM updates.
3773 | */
3774 | private readonly _onCollectionChange;
3775 | /**
3776 | * @description
3777 | * Tracks the list of added `FormControlName` instances
3778 | */
3779 | directives: FormControlName[];
3780 | /**
3781 | * @description
3782 | * Tracks the `FormGroup` bound to this directive.
3783 | */
3784 | form: FormGroup;
3785 | /**
3786 | * @description
3787 | * Emits an event when the form submission has been triggered.
3788 | */
3789 | ngSubmit: EventEmitter;
3790 | constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], callSetDisabledState?: SetDisabledStateOption | undefined);
3791 | /** @docs-private */
3792 | ngOnChanges(changes: SimpleChanges): void;
3793 | /** @docs-private */
3794 | ngOnDestroy(): void;
3795 | /**
3796 | * @description
3797 | * Returns this directive's instance.
3798 | */
3799 | get formDirective(): Form;
3800 | /**
3801 | * @description
3802 | * Returns the `FormGroup` bound to this directive.
3803 | */
3804 | get control(): FormGroup;
3805 | /**
3806 | * @description
3807 | * Returns an array representing the path to this group. Because this directive
3808 | * always lives at the top level of a form, it always an empty array.
3809 | */
3810 | get path(): string[];
3811 | /**
3812 | * @description
3813 | * Method that sets up the control directive in this group, re-calculates its value
3814 | * and validity, and adds the instance to the internal list of directives.
3815 | *
3816 | * @param dir The `FormControlName` directive instance.
3817 | */
3818 | addControl(dir: FormControlName): FormControl;
3819 | /**
3820 | * @description
3821 | * Retrieves the `FormControl` instance from the provided `FormControlName` directive
3822 | *
3823 | * @param dir The `FormControlName` directive instance.
3824 | */
3825 | getControl(dir: FormControlName): FormControl;
3826 | /**
3827 | * @description
3828 | * Removes the `FormControlName` instance from the internal list of directives
3829 | *
3830 | * @param dir The `FormControlName` directive instance.
3831 | */
3832 | removeControl(dir: FormControlName): void;
3833 | /**
3834 | * Adds a new `FormGroupName` directive instance to the form.
3835 | *
3836 | * @param dir The `FormGroupName` directive instance.
3837 | */
3838 | addFormGroup(dir: FormGroupName): void;
3839 | /**
3840 | * Performs the necessary cleanup when a `FormGroupName` directive instance is removed from the
3841 | * view.
3842 | *
3843 | * @param dir The `FormGroupName` directive instance.
3844 | */
3845 | removeFormGroup(dir: FormGroupName): void;
3846 | /**
3847 | * @description
3848 | * Retrieves the `FormGroup` for a provided `FormGroupName` directive instance
3849 | *
3850 | * @param dir The `FormGroupName` directive instance.
3851 | */
3852 | getFormGroup(dir: FormGroupName): FormGroup;
3853 | /**
3854 | * Performs the necessary setup when a `FormArrayName` directive instance is added to the view.
3855 | *
3856 | * @param dir The `FormArrayName` directive instance.
3857 | */
3858 | addFormArray(dir: FormArrayName): void;
3859 | /**
3860 | * Performs the necessary cleanup when a `FormArrayName` directive instance is removed from the
3861 | * view.
3862 | *
3863 | * @param dir The `FormArrayName` directive instance.
3864 | */
3865 | removeFormArray(dir: FormArrayName): void;
3866 | /**
3867 | * @description
3868 | * Retrieves the `FormArray` for a provided `FormArrayName` directive instance.
3869 | *
3870 | * @param dir The `FormArrayName` directive instance.
3871 | */
3872 | getFormArray(dir: FormArrayName): FormArray;
3873 | /**
3874 | * Sets the new value for the provided `FormControlName` directive.
3875 | *
3876 | * @param dir The `FormControlName` directive instance.
3877 | * @param value The new value for the directive's control.
3878 | */
3879 | updateModel(dir: FormControlName, value: any): void;
3880 | /**
3881 | * @description
3882 | * Method called with the "submit" event is triggered on the form.
3883 | * Triggers the `ngSubmit` emitter to emit the "submit" event as its payload.
3884 | *
3885 | * @param $event The "submit" event object
3886 | */
3887 | onSubmit($event: Event): boolean;
3888 | /**
3889 | * @description
3890 | * Method called when the "reset" event is triggered on the form.
3891 | */
3892 | onReset(): void;
3893 | /**
3894 | * @description
3895 | * Resets the form to an initial value and resets its submitted status.
3896 | *
3897 | * @param value The new value for the form, `undefined` by default
3898 | */
3899 | resetForm(value?: any, options?: {
3900 | onlySelf?: boolean;
3901 | emitEvent?: boolean;
3902 | }): void;
3903 | private _setUpFormContainer;
3904 | private _cleanUpFormContainer;
3905 | private _updateRegistrations;
3906 | private _updateValidators;
3907 | static ɵfac: i0.ɵɵFactoryDeclaration;
3908 | static ɵdir: i0.ɵɵDirectiveDeclaration;
3909 | }
3910 |
3911 | /**
3912 | * @description
3913 | *
3914 | * Syncs a nested `FormGroup` or `FormRecord` to a DOM element.
3915 | *
3916 | * This directive can only be used with a parent `FormGroupDirective`.
3917 | *
3918 | * It accepts the string name of the nested `FormGroup` or `FormRecord` to link, and
3919 | * looks for a `FormGroup` or `FormRecord` registered with that name in the parent
3920 | * `FormGroup` instance you passed into `FormGroupDirective`.
3921 | *
3922 | * Use nested form groups to validate a sub-group of a
3923 | * form separately from the rest or to group the values of certain
3924 | * controls into their own nested object.
3925 | *
3926 | * @see [Reactive Forms Guide](guide/forms/reactive-forms)
3927 | *
3928 | * @usageNotes
3929 | *
3930 | * ### Access the group by name
3931 | *
3932 | * The following example uses the `AbstractControl.get` method to access the
3933 | * associated `FormGroup`
3934 | *
3935 | * ```ts
3936 | * this.form.get('name');
3937 | * ```
3938 | *
3939 | * ### Access individual controls in the group
3940 | *
3941 | * The following example uses the `AbstractControl.get` method to access
3942 | * individual controls within the group using dot syntax.
3943 | *
3944 | * ```ts
3945 | * this.form.get('name.first');
3946 | * ```
3947 | *
3948 | * ### Register a nested `FormGroup`.
3949 | *
3950 | * The following example registers a nested *name* `FormGroup` within an existing `FormGroup`,
3951 | * and provides methods to retrieve the nested `FormGroup` and individual controls.
3952 | *
3953 | * {@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'}
3954 | *
3955 | * @ngModule ReactiveFormsModule
3956 | * @publicApi
3957 | */
3958 | declare class FormGroupName extends AbstractFormGroupDirective implements OnInit, OnDestroy {
3959 | /**
3960 | * @description
3961 | * Tracks the name of the `FormGroup` bound to the directive. The name corresponds
3962 | * to a key in the parent `FormGroup` or `FormArray`.
3963 | * Accepts a name as a string or a number.
3964 | * The name in the form of a string is useful for individual forms,
3965 | * while the numerical form allows for form groups to be bound
3966 | * to indices when iterating over groups in a `FormArray`.
3967 | */
3968 | name: string | number | null;
3969 | constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
3970 | static ɵfac: i0.ɵɵFactoryDeclaration;
3971 | static ɵdir: i0.ɵɵDirectiveDeclaration;
3972 | }
3973 | /**
3974 | * @description
3975 | *
3976 | * Syncs a nested `FormArray` to a DOM element.
3977 | *
3978 | * This directive is designed to be used with a parent `FormGroupDirective` (selector:
3979 | * `[formGroup]`).
3980 | *
3981 | * It accepts the string name of the nested `FormArray` you want to link, and
3982 | * will look for a `FormArray` registered with that name in the parent
3983 | * `FormGroup` instance you passed into `FormGroupDirective`.
3984 | *
3985 | * @see [Reactive Forms Guide](guide/forms/reactive-forms)
3986 | * @see {@link AbstractControl}
3987 | *
3988 | * @usageNotes
3989 | *
3990 | * ### Example
3991 | *
3992 | * {@example forms/ts/nestedFormArray/nested_form_array_example.ts region='Component'}
3993 | *
3994 | * @ngModule ReactiveFormsModule
3995 | * @publicApi
3996 | */
3997 | declare class FormArrayName extends ControlContainer implements OnInit, OnDestroy {
3998 | /**
3999 | * @description
4000 | * Tracks the name of the `FormArray` bound to the directive. The name corresponds
4001 | * to a key in the parent `FormGroup` or `FormArray`.
4002 | * Accepts a name as a string or a number.
4003 | * The name in the form of a string is useful for individual forms,
4004 | * while the numerical form allows for form arrays to be bound
4005 | * to indices when iterating over arrays in a `FormArray`.
4006 | */
4007 | name: string | number | null;
4008 | constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
4009 | /**
4010 | * A lifecycle method called when the directive's inputs are initialized. For internal use only.
4011 | * @throws If the directive does not have a valid parent.
4012 | * @docs-private
4013 | */
4014 | ngOnInit(): void;
4015 | /**
4016 | * A lifecycle method called before the directive's instance is destroyed. For internal use only.
4017 | * @docs-private
4018 | */
4019 | ngOnDestroy(): void;
4020 | /**
4021 | * @description
4022 | * The `FormArray` bound to this directive.
4023 | */
4024 | get control(): FormArray;
4025 | /**
4026 | * @description
4027 | * The top-level directive for this group if present, otherwise null.
4028 | */
4029 | get formDirective(): FormGroupDirective | null;
4030 | /**
4031 | * @description
4032 | * Returns an array that represents the path from the top-level form to this control.
4033 | * Each index is the string name of the control on that level.
4034 | */
4035 | get path(): string[];
4036 | static ɵfac: i0.ɵɵFactoryDeclaration;
4037 | static ɵdir: i0.ɵɵDirectiveDeclaration;
4038 | }
4039 |
4040 | /**
4041 | * The type for CALL_SET_DISABLED_STATE. If `always`, then ControlValueAccessor will always call
4042 | * `setDisabledState` when attached, which is the most correct behavior. Otherwise, it will only be
4043 | * called when disabled, which is the legacy behavior for compatibility.
4044 | *
4045 | * @publicApi
4046 | * @see {@link FormsModule#withconfig}
4047 | */
4048 | type SetDisabledStateOption = 'whenDisabledForLegacyCode' | 'always';
4049 |
4050 | /**
4051 | * @description
4052 | * Creates a `FormControl` instance from a [domain
4053 | * model](https://en.wikipedia.org/wiki/Domain_model) and binds it to a form control element.
4054 | *
4055 | * The `FormControl` instance tracks the value, user interaction, and
4056 | * validation status of the control and keeps the view synced with the model. If used
4057 | * within a parent form, the directive also registers itself with the form as a child
4058 | * control.
4059 | *
4060 | * This directive is used by itself or as part of a larger form. Use the
4061 | * `ngModel` selector to activate it.
4062 | *
4063 | * It accepts a domain model as an optional `Input`. If you have a one-way binding
4064 | * to `ngModel` with `[]` syntax, changing the domain model's value in the component
4065 | * class sets the value in the view. If you have a two-way binding with `[()]` syntax
4066 | * (also known as 'banana-in-a-box syntax'), the value in the UI always syncs back to
4067 | * the domain model in your class.
4068 | *
4069 | * To inspect the properties of the associated `FormControl` (like the validity state),
4070 | * export the directive into a local template variable using `ngModel` as the key (ex:
4071 | * `#myVar="ngModel"`). You can then access the control using the directive's `control` property.
4072 | * However, the most commonly used properties (like `valid` and `dirty`) also exist on the control
4073 | * for direct access. See a full list of properties directly available in
4074 | * `AbstractControlDirective`.
4075 | *
4076 | * @see {@link RadioControlValueAccessor}
4077 | * @see {@link SelectControlValueAccessor}
4078 | *
4079 | * @usageNotes
4080 | *
4081 | * ### Using ngModel on a standalone control
4082 | *
4083 | * The following examples show a simple standalone control using `ngModel`:
4084 | *
4085 | * {@example forms/ts/simpleNgModel/simple_ng_model_example.ts region='Component'}
4086 | *
4087 | * When using the `ngModel` within `
4115 | *
4116 | * ```
4117 | *
4118 | * ### Setting the ngModel `name` attribute through options
4119 | *
4120 | * The following example shows you an alternate way to set the name attribute. Here,
4121 | * an attribute identified as name is used within a custom form control component. To still be able
4122 | * to specify the NgModel's name, you must specify it using the `ngModelOptions` input instead.
4123 | *
4124 | * ```html
4125 | *
4129 | *
4130 | * ```
4131 | *
4132 | * @ngModule FormsModule
4133 | * @publicApi
4134 | */
4135 | declare class NgModel extends NgControl implements OnChanges, OnDestroy {
4136 | private _changeDetectorRef?;
4137 | private callSetDisabledState?;
4138 | readonly control: FormControl;
4139 | /** @docs-private */
4140 | static ngAcceptInputType_isDisabled: boolean | string;
4141 | /**
4142 | * Internal reference to the view model value.
4143 | * @docs-private
4144 | */
4145 | viewModel: any;
4146 | /**
4147 | * @description
4148 | * Tracks the name bound to the directive. If a parent form exists, it
4149 | * uses this name as a key to retrieve this control's value.
4150 | */
4151 | name: string;
4152 | /**
4153 | * @description
4154 | * Tracks whether the control is disabled.
4155 | */
4156 | isDisabled: boolean;
4157 | /**
4158 | * @description
4159 | * Tracks the value bound to this directive.
4160 | */
4161 | model: any;
4162 | /**
4163 | * @description
4164 | * Tracks the configuration options for this `ngModel` instance.
4165 | *
4166 | * **name**: An alternative to setting the name attribute on the form control element. See
4167 | * the [example](api/forms/NgModel#using-ngmodel-on-a-standalone-control) for using `NgModel`
4168 | * as a standalone control.
4169 | *
4170 | * **standalone**: When set to true, the `ngModel` will not register itself with its parent form,
4171 | * and acts as if it's not in the form. Defaults to false. If no parent form exists, this option
4172 | * has no effect.
4173 | *
4174 | * **updateOn**: Defines the event upon which the form control value and validity update.
4175 | * Defaults to 'change'. Possible values: `'change'` | `'blur'` | `'submit'`.
4176 | *
4177 | */
4178 | options: {
4179 | name?: string;
4180 | standalone?: boolean;
4181 | updateOn?: FormHooks;
4182 | };
4183 | /**
4184 | * @description
4185 | * Event emitter for producing the `ngModelChange` event after
4186 | * the view model updates.
4187 | */
4188 | update: EventEmitter;
4189 | constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[], _changeDetectorRef?: (ChangeDetectorRef | null) | undefined, callSetDisabledState?: SetDisabledStateOption | undefined);
4190 | /** @docs-private */
4191 | ngOnChanges(changes: SimpleChanges): void;
4192 | /** @docs-private */
4193 | ngOnDestroy(): void;
4194 | /**
4195 | * @description
4196 | * Returns an array that represents the path from the top-level form to this control.
4197 | * Each index is the string name of the control on that level.
4198 | */
4199 | get path(): string[];
4200 | /**
4201 | * @description
4202 | * The top-level directive for this control if present, otherwise null.
4203 | */
4204 | get formDirective(): any;
4205 | /**
4206 | * @description
4207 | * Sets the new value for the view model and emits an `ngModelChange` event.
4208 | *
4209 | * @param newValue The new value emitted by `ngModelChange`.
4210 | */
4211 | viewToModelUpdate(newValue: any): void;
4212 | private _setUpControl;
4213 | private _setUpdateStrategy;
4214 | private _isStandalone;
4215 | private _setUpStandalone;
4216 | private _checkForErrors;
4217 | private _checkName;
4218 | private _updateValue;
4219 | private _updateDisabled;
4220 | private _getPath;
4221 | static ɵfac: i0.ɵɵFactoryDeclaration;
4222 | static ɵdir: i0.ɵɵDirectiveDeclaration;
4223 | }
4224 |
4225 | /**
4226 | * @description
4227 | * Creates and binds a `FormGroup` instance to a DOM element.
4228 | *
4229 | * This directive can only be used as a child of `NgForm` (within `