0

I am trying to put value in text box with two decimal digits example by default it take .00 on entering number

I am using Angular , Reactive form with form Control .

I am sharing my code :

<input placeholder="00.00" (keypress)="convert($event)" formControlName='pendingDuesAmount' [(ngModel)]='pendingAmount'  type="text" [ngModelOptions]="{standalone: true}" >   

TS

 pendingAmount : number = 0.00  

  convert(event): boolean {
      this.pendingAmount.toFixed(2)
  }
ANURAG RANJAN
  • 115
  • 2
  • 16
  • Well and what's the error ? – johannchopin Mar 30 '20 at 08:18
  • Anurag, NOT mix formControlName and [(ngModel)]. Programing is not a "totum revolutum", it's not put code and code and expect work it. Take a look to https://stackoverflow.com/questions/58986023/need-angular-directive-digit-number-and-or-two-decimal-in-the-textbox?noredirect=1&lq=1, – Eliseo Mar 30 '20 at 10:50

0 Answers0