Forked from https://github.com/webcat12345/ngx-intl-tel-input
npm install ngx-intl-tel-input-ggForked from https://github.com/webcat12345/ngx-intl-tel-input

  
An Angular package for entering and validating international telephone numbers. It adds a flag dropdown to any input, detects the user's country, displays a relevant placeholder and provides formatting/validation methods.
!alt
Compatibility:
Validation with google-libphonenumber
| ngx-intl-tel-input-gg | Angular | ngx-bootstrap |
| --------------------- | -------------- | ------------- |
| 1.x.x | 9.x.x - 17.x.x | 6.0.0 |
$ npm install intl-tel-input@17.0.3 --save
$ npm install google-libphonenumber --save
$ ng add ngx-bootstrap
If you do not wish to use Bootstrap's global CSS, we now package the project with only the relevant
bootstrap styling needed for the dropdown. As such, you can remove the bootstrap styling from angular.json.
Further, Angular CLI should tree-shake the rest of Ngx-Boostrap away if you don't utilize other dependencies from
the bootstrap package. This should keep this dependency a lean feature-add
Add _'intl-tel-input'_ style file:
./node_modules/intl-tel-input/build/css/intlTelInput.css
to angular.json styles array:
``json
"styles": [
"./node_modules/intl-tel-input/build/css/intlTelInput.css",
"src/styles.css"
],
`
$ npm install ngx-intl-tel-input-gg --save
Add NgxIntlTelInputModule to your module file:
`javascript`
imports: [NgxIntlTelInputModule];
Refer to main app in this repository for working example.
Or this:
`html`
| Options | Type | Default | Description |
| ------------------------ | ------------------------ | --------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| cssClass | string | control-form | Bootstrap input css class or your own custom one. |
| preferredCountries | | [] | List of countries, which will appear at the top. |
| onlyCountries | | [] | List of manually selected countries, which will appear in the dropdown. |boolean
| enableAutoCountrySelect | | true | Toggle automatic country (flag) selection based on user input. |boolean
| enablePlaceholder | | true | Input placeholder text, which adapts to the country selected. |string
| customPlaceholder | | None | Custom string to be inserted as a placeholder. |
| numberFormat | | PhoneNumberFormat.International | Custom string to be inserted as a placeholder. |boolean
| searchCountryFlag | | false | Enables input search box for countries in the flag dropdown. |
| searchCountryField | | [SearchCountryField.All] | Customize which fields to search in, if searchCountryFlag is enabled. Use SearchCountryField helper enum. |string
| searchCountryPlaceholder | | 'Search Country' | Placeholder value for searchCountryField |number
| maxLength | | None | Add character limit. |boolean
| selectFirstCountry | | true | Selects first country from preferredCountries if is set. If not then uses main list. |boolean
| phoneValidation | | true | Disable phone validation. |string
| inputId | | phone | Unique ID for element. |
| selectedCountryISO | | None | Set specific country on load. |boolean
| separateDialCode | | false | Visually separate dialcode into the drop down element. |
| countryChange | | None | Emits country value when the user selects a country from the dropdown. |
Following formats are supported
- NATIONAL // Produces "044 668 18 00"
- INTERNATIONAL // Produces "+41 44 668 18 00"
- E164 // Produces "+41446681800"
- Fork repo.
- Update ./projects/ngx-intl-tel-input./src/app
- Build / test library.
- Update with new functionality.
- Update README.md
- Pull request.
- Build lib: $ npm run build_lib$ npm run copy-files
- Copy license and readme files: $ npm run npm_pack
- Create package: $ npm run package
- Build lib and create package:
After building and creating package, you can use it locally too.
In your project run:
$ npm install --save {{path to your local '*.tgz' package file}}`
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!