DefaultValueAccessor

directive

The default accessor for writing a value and listening to changes that is used by the NgModel, FormControlDirective, and FormControlName directives.

NgModules

Selectors

Properties

Property Description
onChange: (_: any) => { }
onTouched: () => { }

Description

Example

<input type="text" name="searchQuery" ngModel>

Methods

writeValue(value: any): void

Parameters

value

Type: any.

Returns

void

registerOnChange(fn: (_: any) => void): void

Parameters

fn

Type: (_: any) => void.

Returns

void

registerOnTouched(fn: () => void): void

Parameters

fn

Type: () => void.

Returns

void

setDisabledState(isDisabled: boolean): void

Parameters

isDisabled

Type: boolean.

Returns

void

© 2010–2019 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v6.angular.io/api/forms/DefaultValueAccessor