question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to mask optionally negative number?

See original GitHub issue

Hi,

How do I create a mask for optionally negative number? I have tried mask="-?0*.99" but it doesn’t allow to enter anything after the -

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ldani-devcommented, May 12, 2021

for me this work <input type=“text”
mask=“separator.2” [allowNegativeNumbers]=“true” thousandSeparator=“.” separatorLimit=“100000” formControlName=“amount” />

Note: ngx-mask version 10.0.4 Angular 10+

2reactions
mamontgocommented, Oct 17, 2019

This seems to work: customPatterns = { '0': { pattern: new RegExp('-|[0-9]') }, '9': { pattern: new RegExp('[0-9]') } };

<input mask="09*.99" [patterns]="customPatterns" [dropSpecialCharacters]="false">

Read more comments on GitHub >

github_iconTop Results From Across the Web

ngx-mask to accept negative numbers - angular - Stack Overflow
After delving into the ngx-mask code: There is either missing documentation or a bug that requires the optional character '?' in the mask...
Read more >
Allow negative numbers when using currency input mask
Put a currency input mask on a textfield, put a negative value in it, and try to submit the webform. You will not...
Read more >
Control data entry formats with input masks - Microsoft Support
The third part of the input mask is also optional and indicates a single ... Any positive or negative number, no more than...
Read more >
ASPxTextBox - How to create a mask for negative currency ...
Hi, I've created a mask for ASPxTextBox to allow users to copy and paste currency values from Excel. The idea is to accept...
Read more >
Custom Input Masks (Numeric/Integer) - Informa Software
The mask can contain two parts delimited by the ';' character. The first part defines the mask for entering positive values; the second...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found