NumberValueAccessor

From Get docs
< @angular/formsAngular/docs/10/api/forms/numbervalueaccessor


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.

NgModules

Selectors

  • input[type=number][formControlName]
  • input[type=number][formControl]
  • input[type=number][ngModel]

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

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