NumberValueAccessor
用于写入数字值和监听数字输入框更改的 ControlValueAccessor
。这个值访问器由 FormControlDirective
、FormControlName
和 NgModel
指令使用。
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.
Exported from
选择器
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">