I use ngx-mask 14.2.4. I want to allow the following conditions for my postcode input field:
- between 2 and 12 signs
- allow letters, numbers and '-'. Also allow spaces but not after '-'.
I tried:
<input
type="text"
[mask]="mask"
[patterns]="customPatterns"
[specialCharacters]="['-']"
[showMaskTyped]="true"
[dropSpecialCharacters]="false"/>
and
this.mask = '0{12}';
this.customPatterns = { '0': { pattern: new RegExp('\[A-Za-z0-9- \]')} };
But it didn't work. It doesn't let me input the special characters (space and -). How to achieve the goal?