ngx-mask icon indicating copy to clipboard operation
ngx-mask copied to clipboard

Backspace automatically delete special characters

Open andrewgazelka opened this issue 5 years ago • 2 comments

I feel like, given the popularity of this repo, this is already implemented. Maybe I am blind.

Anyway, is there a way to make it so backspace automatically deletes special characters? For example, it is annoying to have to delete spaces and parenthesis in a phone number mask mask="(000) 000-0000"

andrewgazelka avatar Jan 09 '20 02:01 andrewgazelka

is this issue fixed? i am also facing this issue

velu-dev avatar Apr 16 '21 12:04 velu-dev

I have found an easy fix for this issue, you can use the dynamic valid mask to delete the special characters.

Eg: Your phone number input is mask="(000) 000-0000", as you use backspace the special characters should get deleted automatically. You can simply convert your mask to mask="(000) 000-0000||(000) 000||(000|| "

This is simplest approach to this problem I have figured (make sure to validate your phone number length etc. during submission)

Kashin98 avatar Feb 22 '22 05:02 Kashin98

@andrewgazelka @velu-dev Thanks for your using Ngx-Mask. Please update to latest version. It example, all work as expected - https://stackblitz.com/edit/angular-58eyev?file=src%2Fmain.ts

andriikamaldinov1 avatar Jun 19 '23 09:06 andriikamaldinov1