https://github.com/dashawk/angular-phone-country-prefix
Select Drop Down for country prefixes with country flags
https://github.com/dashawk/angular-phone-country-prefix
Last synced: 5 months ago
JSON representation
Select Drop Down for country prefixes with country flags
- Host: GitHub
- URL: https://github.com/dashawk/angular-phone-country-prefix
- Owner: dashawk
- License: mit
- Created: 2015-08-04T05:53:14.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-08-07T07:37:58.000Z (almost 11 years ago)
- Last Synced: 2026-01-26T14:50:40.717Z (6 months ago)
- Language: JavaScript
- Size: 953 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Angular directive that provides country prefixes with country name and dial code.
# Build #
Currently have no build task
# Test #
Test using karma with gulp build system
```cli
gulp test
```
# Usage #
First, include as dependency in your angular module.
```js
angular.module('myApp', ['phonePrefix']);
```
It will accept a list of countries. In your controller, declare a new scope variable.
The countryID is important since it is used to select our country flag via css.
I got the css from here (forgot the repo name). Contact me if anyone knows the source repo for the flags and the css.
```js
$scope.countries = [
{ countryID: 'au', name: 'Australia', prefix: '+61' },
{ countryID: 'us', name: 'United States', prefix: '+1' }
];
```
It can also accept a phone prefix to pre-select an item in the list
```js
$scope.currentPrefix = '+61';
```
Then in the DOM
```html
```
# Contribution #
Fork this repo and install the dependencies
```cli
npm install
bower install
```