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

Bug Optional 9* problem

Open AngularAlb opened this issue 5 years ago • 3 comments

"ngx-mask": "8.1.7", "ngx-mask": "9.0.2",

I am trying a mask="9*/0* but not working.

i want this case /2020 , 1234/2000, 1234568/202020 ... optional-many/required-many

I also tried mask="999999/0*" and this is not working too .

Am i doing anything wrong ?

AngularAlb avatar Apr 24 '20 00:04 AngularAlb

I may be having the same problem - trying to have a mask that takes 1234-1234 or 12345-1234 so I used the mask 90000-0000. Not only does it not work, but when I input a number into the keypad, I'm getting some really strange behavior (like a number is inserted randomly into the input control)

RoboZoom avatar May 22 '20 04:05 RoboZoom

@RoboZoom @AngularAlb Same problem here. I managed to circunvent this using a dynamic mask: mask="(00) 0000-0000||(00) 00000-0000" instead of using 9 for optional digits.

ivanmonteiro avatar Jun 01 '21 20:06 ivanmonteiro

I still experience this issue. Example of real world cases:

  • czech street number: 99990/990L
  • czech account number: 999999-9999999000/0000
  • or simple example: 9000/0000
    • this one won't accept this input "123/0100"

Basically any mask with optional number before a special character seems to create problems.

The proposed workaround with logical OR in mask didn't work for me. It always take the shorter variant.

Tested with ngx-mask version 13.1.15

kotelnik avatar Jun 15 '22 13:06 kotelnik

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

andriikamaldinov1 avatar Jun 27 '23 12:06 andriikamaldinov1

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

andriikamaldinov1 avatar Jun 27 '23 12:06 andriikamaldinov1