Hello!
I need a help to input currency mask to Ionic 3.
Example, I’ll input type and digits in real number 0.00.
Thanks…
Hello!
I need a help to input currency mask to Ionic 3.
Example, I’ll input type and digits in real number 0.00.
Thanks…
Hi, @medeiraf
You can use angular2-text-mask in ionic 3
https://www.npmjs.com/package/angular2-text-mask
Thanks,
Hi. I dealed with the Angular currency pipe and finally ended making my own input component and using the number pipe like:
| number:'4.2-2'
I had many problems getting the right values.
To use it on a ion-input perhaps your best option is to make your own pipe to format the currency values, something like:
<ion-input
type="tel"
[ngModel]="currencyValue | currencyFormat:applyFormat"
(ngModelChange)="updateData($event)"
(ionBlur)="applyFormat = true;"
(ionFocus)="applyFormat = false;"></ion-input>
Here you’re using single binding so you can apply any custom pipes to format your values.
Take a look at https://stackoverflow.com/questions/34990102/angular2-data-binding-for-custom-reusable-component for the updateData() function.
Also try:
(ngModelChange)="currencyValue=$event.target.value"
or
(ngModelChange)="currencyValue=$event"
Hope it helps. Best regards.
Whoa!
it’s work! Thaanks…
https://www.npmjs.com/package/angular2-text-mask
angular2-text-mask
Unfortunately, we are unable to support Ionic 2 ion-input at this point as it overrides the ControlValueAccessor that Text Mask requires to perform its job.
did u get it ?
Yes, its understood.