Skip to content

dashawk/angular-phone-country-prefix

Repository files navigation

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

gulp test

Usage

First, include as dependency in your angular module.

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.

$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

$scope.currentPrefix = '+61';

Then in the DOM

<phone-prefix ng-model="currentPrefix" countries="countries"></phone-prefix>

Contribution

Fork this repo and install the dependencies

npm install
bower install

About

Select Drop Down for country prefixes with country flags

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published