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

incorrect work in prod mode

Open beckon111 opened this issue 8 years ago • 4 comments

Hello. Module don't works in production mode, but in developer mode all right. How I'm using it on input: <input class="form-control" type="text" title="Телефон" formControlName="phone" [dropSpecialCharacters]="false" [showMaskTyped]="true" mask="+7(000)0000000"> Config in app.module: NgxMaskModule.forRoot({ patterns : { '7': { pattern: new RegExp('\[7\]') }, '0': { pattern: new RegExp('\[0-9\]') }, 'A': { pattern: new RegExp('\[0-9A-Za-z\]') } } }), Angular 6, ngx-mask 6.5.18 Thx for your answers.

beckon111 avatar Oct 29 '18 08:10 beckon111

@beckon111 We will check

NepipenkoIgor avatar Oct 31 '18 09:10 NepipenkoIgor

I tried to do config in const, but it Isn't affect on it. If turn aot off build works fine. (ng build --prod --build-optimizer=false --aot=false)

beckon111 avatar Oct 31 '18 14:10 beckon111

Angular compiler doesn't support regexes and strips them away. One solution is to accept strings in config and convert them to regex at runtime.

LaserUnicorns avatar Oct 31 '18 18:10 LaserUnicorns

@beckon111 Why do you need to declare a custom pattern ? As i see you trued to set standard values for '0' and 'A' and +7 is a prefix 2018-12-13 16 27 07

Thegrep01 avatar Dec 13 '18 14:12 Thegrep01