phone-number-pcicker
This is a component which is inspired by https://intl-tel-input.com/ jquery plugin (https://github.com/jackocnr/intl-tel-input), and rewritten with limited features on angular 4.
Some part of the code has been reused from the https://github.com/jackocnr/intl-tel-input and also sprite images are reused.
build state
Demo and Examples
You can view demo by rebuilding the project with help of npm install and ng serve.
Features
- The user types their national number and the plugin gives you the full standardized international number
- Handle phone number extensions
- Retina flag icons
Browser Compatibility
Chrome | FF | Safari | IE | Chrome Android | Mobile Safari | IE Mob |
---|---|---|---|---|---|---|
✓ | ✓ | ✓ | 11 | ✓ | ✓ | ✓ |
also link for angular support https://angular.io/guide/browser-support
Getting Started
- npm i phone-number-picker
- Imports the phone number picker module in app module or any module where we want it to be used. import {PhoneNumberPickerModule} from 'phone-number-picker' @NgModule({
imports: [ PhoneNumberPickerModule ],
- Add tags in view html <phone-number-picker [elementName]="elementName">
And done.
Options
defaultCountryCode
type -string
default phone-picker-component
Can be used to assign the default country to be selected. Note: Country code shoud be iso code of two letters ex, "us", "ru". And this property is not cases sensitive.
autoDetectCountry
type -boolean
default phone-picker-component
Can be used to enable auto detect the client country and select it default Note: Country code shoud be iso code of two letters ex, "us", "ru". And this property is not cases sensitive.
Events
phonePickerCountryChange
type -EventEmitter
this event triggers when country selection is made, wither by entering the code or combobox selection. the event return type is country object
Model
Country
property:
name: string
iso2Code: string
dialCode: number
order: number
areaCodes: any
Todo
- Add unit testing and e2e testing