On this page
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
input:not([type=checkbox])[formControlName]
textarea[formControlName]
input:not([type=checkbox])[formControl]
textarea[formControl]
input:not([type=checkbox])[ngModel]
textarea[ngModel]
[ngDefaultControl]
Properties
Property | Description |
---|---|
onChange: (_: any) => { } |
|
onTouched: () => { } |
Description
Example
<input type="text" name="searchQuery" ngModel>
Methods
writeValue()
|
||
---|---|---|
|
value | Type: |
Returns
void
registerOnChange()
|
||
---|---|---|
|
fn | Type: |
Returns
void
registerOnTouched()
|
||
---|---|---|
|
fn | Type: |
Returns
void
setDisabledState()
|
||
---|---|---|
|
isDisabled | Type: |
Returns
void
© 2010–2019 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v6.angular.io/api/forms/DefaultValueAccessor