Package Exports
- intl-tel-input-ng
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (intl-tel-input-ng) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
intl-tel-input-ng
Changelog
Contributing
Use the fork, Luke. PR without tests will likely not be merged.
What is it ?
It's an angular component to easily integrate intl-tel-input.
Installation
To install this library, run:
# install intl-tel-input
$ npm install intl-tel-input --save / yarn add intl-tel-input
# install this module
$ npm install intl-tel-input-ng --save / yarn add intl-tel-input-ng- Add
node_modules/intl-tel-input/build/js/utils.jsto thescriptssection in yourangular.json. - Add
node_modules/intl-tel-input/build/css/intlTelInput.cssto thestylessection in yourangular.json. - Import
IntlTelInputNgModule.forRoot()in your main application module.
Options
options: An object wrapping theintl-tel-inputoptions.onlyLocalized: Iftrue, displays only localized country data. See here.label: If specified, will generate alabelfor the input (if the name option is set too).name: Setsnameandidattributes for the input. The default value isintl-tel-input-name.cssClass: The CSS class used to style the input component.labelCssClass: The CSS class used to style the label associated to the input.required: Sets therequired&&aria-requiredattributes for the input.[(E164PhoneNumber)]: Outputs the phone number in E164 format if valid.
See the intl-tel-input repository for more documentation.
Example:
The component must be declared between <form> tags !
<form #form="ngForm">
<intl-tel-input
[label]="'Please enter your phone number'"
[name]="'my-name'"
[cssClass]="'form-control'"
[labelCssClass]="'col-sm-2 col-form-label'"
[required]="true"
[options]="{
preferredCountries: ['ch'],
localizedCountries: { ch: 'Suisse' },
onlyCountries: ['fr', 'ch']
}"
[onlyLocalized]="true"
[(E164PhoneNumber)]="E164PhoneNumber"></intl-tel-input>
</form>