RangeValueAccessor
此 ControlValueAccessor
用于写入范围输入器的值,并监听范围输入器的变化。它被 FormControlDirective
、FormControlName
和 NgModel
使用。
The ControlValueAccessor
for writing a range value and listening to range input changes. The value accessor is used by the FormControlDirective
, FormControlName
, and NgModel
directives.
Exported from
选择器
input[type=range][formControlName]
input[type=range][formControl]
input[type=range][ngModel]
说明
使用带响应式表单的范围输入器
Using a range input with a reactive form
以下示例显示了如何在响应式表单中使用范围输入器。
The following example shows how to use a range input with a reactive form.
const ageControl = new FormControl();
<input type="range" [formControl]="ageControl">