JsDaddy / ngx-mask

Angular Plugin to make masks on form fields and html elements.
https://jsdaddy.github.io/ngx-mask
MIT License
1.14k stars 298 forks source link

Multiple masks with copy and paste input #1365

Open weilinzung opened 1 month ago

weilinzung commented 1 month ago

🐞 bug report

Is this a regression?

N/A

Description

  <mat-form-field>
    <mat-label>Enter your area code</mat-label>
    <input
      matInput
      placeholder="10001 or M5A 1D3"
      [formControl]="areaCode"
      [mask]="'00000||S0S 0S0'"
      type="text"
      required
    />
  </mat-form-field>

πŸ”¬ Minimal Reproduction

https://stackblitz.com/edit/y6guau?file=src%2Fexample%2Fform-field-error-example.html

πŸ”₯ Exception or Error

We are expecting the masked value with space in between, and the multiple masks should either mask value for US zip code or Canada postal code format => '00000||S0S 0S0.

🌍 Your Environment

Angular Version: 17.3.0

Angular CLI: 17.3.0
Node: 18.18.0
Package Manager: yarn 1.22.19
OS: linux x64

Angular: 17.3.0
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1703.0
@angular-devkit/build-angular      17.3.0
@angular-devkit/core               17.3.0
@angular-devkit/schematics         17.3.0
@angular/cdk                       17.3.6
@angular/material                  17.3.6
@angular/material-experimental     17.3.6
@angular/material-moment-adapter   17.3.6
@schematics/angular                17.3.0
rxjs                               7.4.0
typescript                         5.4.2
zone.js                            0.14.0