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

Simple Decimal Mask Not working! #848

Closed
sajjansarkar opened this issue Jan 4, 2021 · 5 comments
Closed

Simple Decimal Mask Not working! #848

sajjansarkar opened this issue Jan 4, 2021 · 5 comments

Comments

@sajjansarkar
Copy link

sajjansarkar commented Jan 4, 2021

🐞 bug report

Is this a regression?

Not sure, I have an example using version 8.0.1 which works but that's Angular 8

Description

I would like a textbox that allows only 2 decimals. This example ( using Angular 8 and an older mask version ) works , but the newer version doesnt!
<input type="text" mask="99999999999999.00">

🔬 Minimal Reproduction

https://stackblitz.com/edit/angular-ivy-mask-9g3gqs?file=src%2Fapp%2Fapp.component.html

ngx-mask

🔥 Exception or Error

Pressing a dot makes it enter 2 dots. Subsequent numbers look replicated and wrong.
image

image

🌍 Your Environment

Angular Version:


    _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 8.3.28
Node: 10.19.0
OS: win32 x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.28
@angular-devkit/build-angular     0.803.29
@angular-devkit/build-optimizer   0.803.29
@angular-devkit/build-webpack     0.803.29
@angular-devkit/core              8.3.28
@angular-devkit/schematics        8.3.28
@angular/cdk                      8.2.3
@angular/cli                      8.3.28
@angular/material                 8.2.3
@ngtools/webpack                  8.3.29
@schematics/angular               8.3.28
@schematics/update                0.803.28
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

Anything else relevant?

@Maks-Yaremenko
Copy link

faced the same issue for mask="999 999 999.00"

@sajjansarkar
Copy link
Author

@Maks-Yaremenko someone needs to fix this, but if you need a workaround, i got this to work for me, maybe you can tweak it for you?

<input type="text" mask="separator.2" thousandSeparator="" separatorLimit="99999999999999">

seeing no response here I posted it on SO and Ashot Aleqsanyan was kind enough to provide this workaround.

SO link : https://stackoverflow.com/a/65586834/437328

@Maks-Yaremenko
Copy link

@sajjansarkar yeah! thanks, buddy! It partially solves my issue, ideally whenever the separator limit reached I'm expecting the mask should set a dot instead of just disallow typing. Anyhow it definitely better than it was implemented in our app before))

For example in the case of mask 999.99, the user was able to type 999.99 OR 99999 what was invalid)) now he can type only 999, and then in the case of putting dot able to add .99

Thanks one more time!

@NepipenkoIgor
Copy link
Collaborator

@sajjansarkar @Maks-Yaremenko Thank you that using our plugin. . Yes better will be to use mask separator . But currently we fixed behaviour please check version >13.1.5

@zane2007
Copy link

zane2007 commented May 10, 2023

I'm facing with the same issue using comma as decimalMarker. For instance mask='99999,00' for input 109.3645 format it as 109.3,36. For mask 99999.00 works fine. Also the changes that were made in 13.1.5 don't affect mask 0999.00, only 9999.00.

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

No branches or pull requests

4 participants