A simple international telephone number input. Allows you to create a phone number field with country dropdown.
This is re-written version (with enhancement) of ng4-intl-phone. So credit should go to kondi0 and nikhiln It resolves an issue of +39 with itlay and vatican city as the code for vc is +379 and it also enhances the searching with dial code as well as name of country, all things remain the same with ngx-international-phone-number. Moreover i have added language support. Now we can access different languages using locale. This library is created by Agha Ali Abbas.
To install this library, run:
$ npm install ng-phone-number --save
Consuming your library
Once you have installed it you can import
ng-phone-number in any application module. E.g.
;;;// Import your library;
Once it is imported, you can use
<!-- app.component.html -->Phone number is required and should be validSubmit
defaultCountryCode : An ISO 639-1 country code can be provided to set default country selected. placeholder: A placeholder text which would be displayed in input widget required: Indicates whether it's required or not allowDropdown: Indicates whether to allow selecting country from dropdown allowedCountries: A list of countries (iso codes) that would get display in country dropdown. E.g. [allowedCountries]="['in', 'ca', 'us']" would only show Canada, India and US. If not provided, all the countries would get displayed. locale: It is for language support. If locale is not provided then english will be used by default.
If you are getting error "Can't resolve 'google-libphonenumber'" while building with aot, try to install google-libphonenumber. Run npm install firstname.lastname@example.org --save
Right now ng-phone-number supports 3 languages.
I am working on adding more languages,If you want your language to be added you can put up a request at
email@example.com. You can also suggest any other feature.
* Original Author: kondi0 * Author: Agha Ali Abbas