I am trying to change the default promptCharacter in ngxMask in angular

1.2k Views Asked by At

I am using ngxmask in Angular to display the phone number in the following pattern:

(000) 000-0000

I set showMaskTyped Property to true to always display the mask pattern in the input which looks as the following:

(___) ___-____

I want to replace the _ with custom value # so that it looks like the following:

(###) ###-####

Here is the code:

<input mask="(000) 000-0000" [showMaskTyped]="true">

Here is the live example: https://jsdaddy.github.io/ngx-mask-page/mask-component#show-mask

What would be the best way to replace the default _ with #?

1

There are 1 best solutions below

0
On

According to the documentation, placeHolderCharacter will allow you to override the default _.

In your case, you will do the following:

<input mask="(000) 000-0000" [showMaskTyped]="true" placeHolderCharacter="#" />