Search code examples
javascriptangulartypescriptngx-international-phone-number

How to search by country by country code in ngx-intl-tel-input


I am using this stackblitz link to implement phone number field in my application However I noticed that we cannot search country by typing country code such as +231 in country search dropdown. If I type country name then it takes me to the country but by code it is not working.

Can someone help me to either write a logic that will not allow user to enter numbers or help in search using country code also.

Search by country name

Search by country name is working fine although I would have preffered if it removed other results

Search by country code does nothing

enter image description here


Solution

  • Yes sure, have a look at the options you can pass as input: https://github.com/webcat12345/ngx-intl-tel-input#options

    Look at the SearchCountryField enum - it has DialCode available.

    Adding that to your searchCountryField array will enable searching by dial code.