Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular - Apply decimal pipe to an input

I want to apply decimal pipe on an input so the user can see comma separated numbers as he/she types. I have tried the ngx-mask but that only works if you type in the input. When you patch a value to the input it doesn't transform the value into decimal format.

like image 960
Saad Iqbal Avatar asked May 09 '26 11:05

Saad Iqbal


1 Answers

Basically you can use ngModelChange when you value change you can use a pipe in your ngModel as below

<input [ngModel]="item.value | currency" (ngModelChange)="item.value=$event"
name="name" type="text" />

and more detail about it check this

like image 146
errorau Avatar answered May 11 '26 00:05

errorau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!