Interface ValueControl<T>

interface ValueControl<T = any> {
    registerOnChange(fn: (value?: null | T) => void): void;
    setDisabledState(isDisabled: boolean): void;
    writeValue(opt: { mode: "reset"; value?: undefined }): void;
    writeValue(
        opt: { mode?: "autocomplete" | "restore"; value: null | T },
    ): void;
    writeValue(opt: { mode?: WriteValueMode; value?: null | T }): void;
    writeValue(opt: WriteValueOptions<T>): void;
}

Type Parameters

  • T = any

Methods

  • This method is called when new ValueControl assigned to the form associated element.

    When implementing the registerOnChange method in your own value accessor, save the given function so your class calls it at the appropriate time.

    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:


    onChange(event: Event){

    }

    Parameters

    • fn: (value?: null | T) => void

      the function to be called when a control want to change the value of a form associated element.

    Returns void

  • called when disabled attribute change.

    Parameters

    • isDisabled: boolean

    Returns void

  • reset the value of the

    Parameters

    • opt: { mode: "reset"; value?: undefined }

    Returns void

  • When the browser restores the state of the element (for example, after a navigation, or when the browser restarts). The mode argument is "restore" in this case.

    When the browser's input-assist features such as form auto filling sets a value. The mode argument is "autocomplete" in this case.

    Parameters

    • opt: { mode?: "autocomplete" | "restore"; value: null | T }

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void