NumberValueAccessor
The ControlValueAccessor
for writing a number value and listening to number input changes. The value accessor is used by the FormControlDirective
, FormControlName
, and NgModel
directives.
NgModules
选择器
input[type=number][formControlName]
input[type=number][formControl]
input[type=number][ngModel]
属性
说明
Using a number input with a reactive form.
The following example shows how to use a number input with a reactive form.
const totalCountControl = new FormControl();
<input type="number" [formControl]="totalCountControl">
方法
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. |