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.
API
class NumberValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor {}
writeValue
voidSets the "value" property on the input element.
numbervoidregisterOnChange
voidRegisters a function called when the control value changes.
(_: number | null) => voidvoidonChange
(_: any) => voidThe registered callback function called when a change or input event occurs on the input element.
onTouched
() => voidThe registered callback function called when a blur event occurs on the input element.
setProperty
voidHelper method that sets a property on a target element using the current Renderer implementation.
stringanyvoidregisterOnTouched
voidRegisters a function called when the control is touched.
() => voidvoidsetDisabledState
voidSets the "disabled" property on the range input element.
booleanvoidDescription
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 by
Usage Notes
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">

