Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gauravsoni119/ng2-tel-input
https://github.com/gauravsoni119/ng2-tel-input
angular gulp intltelinput typescript
Last synced: about 3 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/gauravsoni119/ng2-tel-input
- Owner: gauravsoni119
- License: mit
- Created: 2016-10-06T17:05:50.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-03T05:31:57.000Z (almost 2 years ago)
- Last Synced: 2024-11-02T02:02:44.325Z (13 days ago)
- Topics: angular, gulp, intltelinput, typescript
- Language: JavaScript
- Size: 306 KB
- Stars: 56
- Watchers: 7
- Forks: 56
- Open Issues: 54
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- License: LICENSE
Awesome Lists containing this project
README
This repository is no longer maintained.
# Angular 2+ wrapper for intl-tel-input
# Installation
Run following command to install ng2-tel-input
```sh
npm install ng2-tel-input intl-tel-input --save
```After install, you need to add **intlTelInput.css**, **intlTelInput.min.js**, **utils.js**.
In case of @angular/cli, add 2 files in your `angular.json`.
For example,
- Include **intlTelInput.css** in "styles" at your `angular.json` file :
```
"styles": [
...
"node_modules/intl-tel-input/build/css/intlTelInput.css",
...
]
```- Include **intlTelInput.min.js**, **utils.js** in "scripts" at your `angular.json` file :
```
"scripts": [
...
"node_modules/intl-tel-input/build/js/intlTelInput.min.js"
...
]
```Now add Ng2TelInputModule into your AppModule. For example,
```js
import {Ng2TelInputModule} from 'ng2-tel-input';
```Once done, we are ready to use this library.
# How to use?
In order to use this directive, you need to add "ng2TelInput" directive with "[ng2TelInputOptions]" options to your text field. For example,
```html
```
# Note
**(intlTelInputObject)** returns **intl-tel-input** instance.
By default this package get **utils.js** from below link:-
https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/16.0.1/js/utils.js
But you can also provide your utilsScript file by using below options:-[ng2TelInputOptions]="{initialCountry: 'in', utilsScript: 'node_modules/intl-tel-input/build/js/utils.js'}"
# How to use this instance?
You can use it perform any functionality that is available on intl-tel-input plugin. **For example**, in your component,
```
telInputObject(obj) {
console.log(obj);
obj.setCountry('in');
}
```