how to add decimal in angular reactive form control with value starting with 1 and greater


I want to add a decimal and then 0 after 1 like 1.0

<input type="number" formControlName="global_velocity_weight" />

this.form ={
   global_velocity_weight: new FormControl(1.0, { validators: [Validators.required] })

But it is not working and in the input, only 1 is shown.


you can achieve this using angular DecimalPipe inside your form template.

<form [formGroup]="myForm">
        [value]="myForm.get('global_velocity_weight').value | number" // here you pipe the value

Answered By – user12163165

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.