DefaultValueAccessor
The default ControlValueAccessor for writing a value and listening to changes on input elements. The accessor is used by the FormControlDirective, FormControlName, and NgModel directives.
NgModules
选择器
input:not([type=checkbox])[formControlName]textarea[formControlName]input:not([type=checkbox])[formControl]textarea[formControl]input:not([type=checkbox])[ngModel]textarea[ngModel][ngDefaultControl]
属性
说明
Using the default value accessor
The following example shows how to use an input element that activates the default value accessor (in this case, a text field).
const firstNameControl = new FormControl();
<input type="text" [formControl]="firstNameControl">
方法
Sets the "value" property on the input element. |
Registers a function called when the control value changes. |
Registers a function called when the control is touched. |
Sets the "disabled" property on the input element. |