Formatting Phone Number Input In Angular

Discussão em 'Angular' iniciado por Gabe, Maio 4, 2025.

  1. Gabe

    Gabe Guest

    I have seen many solutions to formatting a phone number input field in Angularjs, but I cannot find anything on Angular 7. What I essentially want is for the user to type the following in the textfield:


    123456789
    ​

    and for the textfield to format the input as:


    (123) 456-789
    ​

    how can I go about doing this? I have found the following regex to validate it:

    ^(\([0-9]{3}\) |[0-9]{3}-)[0-9]{3}-[0-9]{4}$

    Continue reading...

Compartilhe esta Página