/** * @license Angular v19.2.13 * (c) 2010-2025 Google LLC. https://angular.io/ * License: MIT */ import * as i0 from '@angular/core'; import { Renderer2, ElementRef, InjectionToken, OnDestroy, OnChanges, SimpleChanges, OnInit, Injector, EventEmitter, ChangeDetectorRef, AfterViewInit, Version, ModuleWithProviders } from '@angular/core'; import { Observable } from 'rxjs'; /** * @description * * Adds `novalidate` attribute to all forms by default. * * `novalidate` is used to disable browser's native form validation. * * If you want to use native validation with Angular forms, just add `ngNativeValidate` attribute: * * ```html *
* ``` * * @publicApi * @ngModule ReactiveFormsModule * @ngModule FormsModule */ declare class ɵNgNoValidate { static ɵfac: i0.ɵɵFactoryDeclaration<ɵNgNoValidate, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<ɵNgNoValidate, "form:not([ngNoForm]):not([ngNativeValidate])", never, {}, {}, never, never, false, never>; } /** * @description * Defines an interface that acts as a bridge between the Angular forms API and a * native element in the DOM. * * Implement this interface to create a custom form control directive * that integrates with Angular forms. * * @see {@link DefaultValueAccessor} * * @publicApi */ interface ControlValueAccessor { /** * @description * Writes a new value to the element. * * This method is called by the forms API to write to the view when programmatic * changes from model to view are requested. * * @usageNotes * ### Write a value to the element * * The following example writes a value to the native DOM element. * * ```ts * writeValue(value: any): void { * this._renderer.setProperty(this._elementRef.nativeElement, 'value', value); * } * ``` * * @param obj The new value for the element */ writeValue(obj: any): void; /** * @description * Registers a callback function that is called when the control's value * changes in the UI. * * This method is called by the forms API on initialization to update the form * model when values propagate from the view to the model. * * When implementing the `registerOnChange` method in your own value accessor, * save the given function so your class calls it at the appropriate time. * * @usageNotes * ### Store the change function * * The following example stores the provided function as an internal method. * * ```ts * registerOnChange(fn: (_: any) => void): void { * this._onChange = fn; * } * ``` * * When the value changes in the UI, call the registered * function to allow the forms API to update itself: * * ```ts * host: { * '(change)': '_onChange($event.target.value)' * } * ``` * * @param fn The callback function to register */ registerOnChange(fn: any): void; /** * @description * Registers a callback function that is called by the forms API on initialization * to update the form model on blur. * * When implementing `registerOnTouched` in your own value accessor, save the given * function so your class calls it when the control should be considered * blurred or "touched". * * @usageNotes * ### Store the callback function * * The following example stores the provided function as an internal method. * * ```ts * registerOnTouched(fn: any): void { * this._onTouched = fn; * } * ``` * * On blur (or equivalent), your class should call the registered function to allow * the forms API to update itself: * * ```ts * host: { * '(blur)': '_onTouched()' * } * ``` * * @param fn The callback function to register */ registerOnTouched(fn: any): void; /** * @description * Function that is called by the forms API when the control status changes to * or from 'DISABLED'. Depending on the status, it enables or disables the * appropriate DOM element. * * @usageNotes * The following is an example of writing the disabled property to a native DOM element: * * ```ts * setDisabledState(isDisabled: boolean): void { * this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); * } * ``` * * @param isDisabled The disabled status to set on the element */ setDisabledState?(isDisabled: boolean): void; } /** * Base class for all ControlValueAccessor classes defined in Forms package. * Contains common logic and utility functions. * * Note: this is an *internal-only* class and should not be extended or used directly in * applications code. */ declare class BaseControlValueAccessor { private _renderer; private _elementRef; /** * The registered callback function called when a change or input event occurs on the input * element. * @docs-private */ onChange: (_: any) => void; /** * The registered callback function called when a blur event occurs on the input element. * @docs-private */ onTouched: () => void; constructor(_renderer: Renderer2, _elementRef: ElementRef); /** * Helper method that sets a property on a target element using the current Renderer * implementation. * @docs-private */ protected setProperty(key: string, value: any): void; /** * Registers a function called when the control is touched. * @docs-private */ registerOnTouched(fn: () => void): void; /** * Registers a function called when the control value changes. * @docs-private */ registerOnChange(fn: (_: any) => {}): void; /** * Sets the "disabled" property on the range input element. * @docs-private */ setDisabledState(isDisabled: boolean): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Base class for all built-in ControlValueAccessor classes (except DefaultValueAccessor, which is * used in case no other CVAs can be found). We use this class to distinguish between default CVA, * built-in CVAs and custom CVAs, so that Forms logic can recognize built-in CVAs and treat custom * ones with higher priority (when both built-in and custom CVAs are present). * * Note: this is an *internal-only* class and should not be extended or used directly in * applications code. */ declare class BuiltInControlValueAccessor extends BaseControlValueAccessor { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Used to provide a `ControlValueAccessor` for form controls. * * See `DefaultValueAccessor` for how to implement one. * * @publicApi */ declare const NG_VALUE_ACCESSOR: InjectionToken; /** * @description * The `ControlValueAccessor` for writing select control values and listening to select control * changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and * `NgModel` directives. * * @usageNotes * * ### Using select controls in a reactive form * * The following examples show how to use a select control in a reactive form. * * {@example forms/ts/reactiveSelectControl/reactive_select_control_example.ts region='Component'} * * ### Using select controls in a template-driven form * * To use a select in a template-driven form, simply add an `ngModel` and a `name` * attribute to the main `` supports `compareWith` input. * `compareWith` takes a **function** which has two arguments: `option1` and `option2`. * If `compareWith` is given, Angular selects option by the return value of the function. * * ```ts * const selectedCountriesControl = new FormControl(); * ``` * * ```html * * * compareFn(c1: Country, c2: Country): boolean { * return c1 && c2 ? c1.id === c2.id : c1 === c2; * } * ``` * * **Note:** We listen to the 'change' event because 'input' events aren't fired * for selects in IE, see: * https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event#browser_compatibility * * @ngModule ReactiveFormsModule * @ngModule FormsModule * @publicApi */ declare class SelectControlValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor { /** @docs-private */ value: any; /** * @description * Tracks the option comparison algorithm for tracking identities when * checking for changes. */ set compareWith(fn: (o1: any, o2: any) => boolean); private _compareWith; /** * Sets the "value" property on the select element. * @docs-private */ writeValue(value: any): void; /** * Registers a function called when the control value changes. * @docs-private */ registerOnChange(fn: (value: any) => any): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * @description * Marks `