Ayush Gupta
Ayush Gupta

Reputation: 9305

Validate Phone Number and Country Code combination for phone number validition in Angular 4?

In my angular 4 application, I have a dropdown for Country Code and a Text Field for Phone Number.

Now, I want to check whether the given phone number is valid within the domain covered by the Country Code.

That means, If the user selectes the following:

countryCode: +91,
phoneNumber: 98784841110

I want to verify whether the country code and phone number are valid as a combination.

I also have the country names and ShortCodes if needed, basically, an element of the array I populate my country code dropdown looks are follows:

{
"shortCode": "GB",
"dialCode": "44",
"name": "United Kingdom"
},

So how can I do it?

Upvotes: 1

Views: 3702

Answers (1)

Ganesh
Ganesh

Reputation: 3474

You might want to use this plugin. https://github.com/webcat12345/ngx-intl-tel-input

Upvotes: 1

Related Questions