W3cubDocs

/Angular 12

NumberValueAccessor

directive

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

Selectors

Description

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">

Methods

registerOnChange(fn: (_: number) => void): void

Parameters
fn (_: number) => void
Returns

void

© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v12.angular.io/api/forms/NumberValueAccessor