It would be nice to be able to config if a negative number is allowed in separator mask. For most of my currency inputs I don't want the user to be able to type negative numbers.
This is will be very nice.
Currently I couldn't find a simple way to block "-" character in inputs with the separator masks.
Even if the dropSpecialCharacters works, it would be good to prevent user typing.
Edit (01/16/2020)
The way I found to remove "-" from is through (keypress) event, where you have a check if the character pressed is "-".
<input formControlName="currency" mask="separator.2" name="currency" separatorLimit="100" type="text" dropSpecialCharacters="true" (keypress)="isPositive($event)" />
isPositive(event: any) {
return event.key === '-' ? false : true;
}
It works good. Obviously not as good as having the option to configure if negative numbers are allowed. :)
Should be fixed in https://github.com/JsDaddy/ngx-mask/pull/708
Most helpful comment
This is will be very nice.
Currently I couldn't find a simple way to block "-" character in inputs with the separator masks.
Even if the dropSpecialCharacters works, it would be good to prevent user typing.
Edit (01/16/2020)
The way I found to remove "-" from is through (keypress) event, where you have a check if the character pressed is "-".
<input formControlName="currency" mask="separator.2" name="currency" separatorLimit="100" type="text" dropSpecialCharacters="true" (keypress)="isPositive($event)" />isPositive(event: any) { return event.key === '-' ? false : true; }It works good. Obviously not as good as having the option to configure if negative numbers are allowed. :)