coersystem
Version:
Library for Angular projects
27 lines (26 loc) • 1.18 kB
TypeScript
import { ControlValueAccessor } from "@angular/forms";
export declare const CONTROL_VALUE: <T>(component: T) => {
provide: import("@angular/core").InjectionToken<readonly ControlValueAccessor[]>;
useExisting: import("@angular/core").Type<any>;
multi: boolean;
};
/** Implements the ControlValueAccessor interface to build a components */
export declare abstract class ControlValue implements ControlValueAccessor {
private _isTouched;
private _IsTouched;
protected _UpdateValue: Function;
/** Current value of the component */
protected _value: any;
/** Property to validate if the component has been touched */
get isTouched(): boolean;
/** Sets the value of the component when it is created */
writeValue(value: any): void;
/** Sets the value of the component when it is updated */
registerOnChange(callback: Function): void;
/** Sets the component's touched status when it is updated */
registerOnTouched(callback: Function): void;
/** Sets the value of the component */
protected SetValue(value: any): void;
/** Sets whether the component has been touched */
SetTouched(isTouched: boolean): void;
}