Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve decimal values on model but not on display? #890

Closed
MikePogson opened this issue Apr 29, 2021 · 1 comment
Closed

Preserve decimal values on model but not on display? #890

MikePogson opened this issue Apr 29, 2021 · 1 comment

Comments

@MikePogson
Copy link

Hi,

I was wondering if there was some way to preserve the decimals in a value but not displaying those decimals? What I am seeing is that as soon as a user edits the model value loses its decimals and that causes some data loss even though the user doesnt want to see it. I have a set up like this:

<input type="text" [allowNegativeNumbers]="true" mask="separator.0" thousandSeparator="," [(ngModel)]="amount">

where a model value of 99.99 after edit would turn into just 99. Is there anyway to preserve that decimal value?

Thanks

andriikamaldinov1 added a commit that referenced this issue Aug 15, 2023
andriikamaldinov1 added a commit that referenced this issue Aug 18, 2023
andriikamaldinov1 added a commit that referenced this issue Aug 18, 2023
andriikamaldinov1 added a commit that referenced this issue Aug 18, 2023
andriikamaldinov1 added a commit that referenced this issue Aug 18, 2023
andriikamaldinov1 added a commit that referenced this issue Aug 18, 2023
andriikamaldinov1 added a commit that referenced this issue Aug 18, 2023
NepipenkoIgor pushed a commit that referenced this issue Aug 18, 2023
* fix(#841): fix(#841)

* fix(#890): fix(#890)

* fix(#890): fix(#890)

* fix(#890): fix(#890)

* fix(#890): fix(#890)

* fix(#890): fix(#890)

* fix(#890): fix(#890)

* fix(#890): fix(#890)
@andriikamaldinov1
Copy link
Collaborator

@MikePogson Thanks for using Ngx-mask. We add two new function "inputTransformFn" and "outputTransformFn".
It example with your case - https://stackblitz.com/edit/stackblitz-starters-9ntpw6?file=src%2Fmain.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants