# country-picker

> An Ionic project

Latest version **0.0.10** (published 2018-05-29) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install country-picker
pnpm add country-picker
yarn add country-picker
bun add country-picker
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.10 |
| Published | 2018-05-29 |
| First published | 2018-05-18 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 22 |
| Unpacked size | 190.4 KB |
| Known vulnerabilities | 0 (+22 in 4 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Brijesh Patel |
| Maintainers | brijeshptl62 |

## Links

- npm: https://www.npmjs.com/package/country-picker
- Repository: https://github.com/brijeshptl62/country-picker
- Homepage: http://ionicframework.com/
- Issues: https://github.com/brijeshptl62/country-picker/issues
- npm.io page: https://npm.io/package/country-picker

## Dependencies (22)

- [rxjs](https://npm.io/package/rxjs.md) 5.5.10
- [zone.js](https://npm.io/package/zone.js.md) 0.8.26
- [firebase](https://npm.io/package/firebase.md) ^4.13.1
- [ionicons](https://npm.io/package/ionicons.md) 3.0.0
- [sw-toolbox](https://npm.io/package/sw-toolbox.md) 3.6.0
- [@types/node](https://npm.io/package/@types/node.md) ^10.1.0
- [angularfire2](https://npm.io/package/angularfire2.md) ^5.0.0-rc.4
- [@angular/core](https://npm.io/package/@angular/core.md) 5.2.10
- [@angular/http](https://npm.io/package/@angular/http.md) 5.2.10
- [ionic-angular](https://npm.io/package/ionic-angular.md) 3.9.2
- [@angular/forms](https://npm.io/package/@angular/forms.md) 5.2.10
- [@ionic/storage](https://npm.io/package/@ionic/storage.md) 2.1.3
- [@angular/common](https://npm.io/package/@angular/common.md) 5.2.10
- [@angular/compiler](https://npm.io/package/@angular/compiler.md) 5.2.10
- [@ionic-native/core](https://npm.io/package/@ionic-native/core.md) 4.7.0
- [@angular/animations](https://npm.io/package/@angular/animations.md) 5.2.10
- [@angular/compiler-cli](https://npm.io/package/@angular/compiler-cli.md) 5.2.10
- [google-libphonenumber](https://npm.io/package/google-libphonenumber.md) ^3.1.5
- [@ionic-native/status-bar](https://npm.io/package/@ionic-native/status-bar.md) 4.7.0
- [@angular/platform-browser](https://npm.io/package/@angular/platform-browser.md) 5.2.10
- [@ionic-native/splash-screen](https://npm.io/package/@ionic-native/splash-screen.md) 4.7.0
- [@angular/platform-browser-dynamic](https://npm.io/package/@angular/platform-browser-dynamic.md) 5.2.10

## Recent versions

- 0.0.10 (latest) — 2018-05-29
- 0.0.9 — 2018-05-28
- 0.0.8 — 2018-05-28
- 0.0.7 — 2018-05-28
- 0.0.6 — 2018-05-22
- 0.0.5 — 2018-05-22
- 0.0.4 — 2018-05-22
- 0.0.3 — 2018-05-18
- 0.0.2 — 2018-05-18
- 0.0.1 — 2018-05-18

## README

# country-picker

A plugin 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.

This is a template for building your own reusable Angular4/Ionic3 module using TypeScript. 

![screen shot 2018-05-24 at 11 22 24 am](https://user-images.githubusercontent.com/31919690/40466786-cde32ef6-5f44-11e8-9746-942bb0a4cd81.png)

![screen shot 2018-05-24 at 11 19 42 am](https://user-images.githubusercontent.com/31919690/40466722-898998e4-5f44-11e8-9614-4d3fc5ab5521.png)


## Browser Compatibility

Chrome | FF | Safari | IE | Chrome Android | Mobile Safari | IE Mob
--- | --- | --- | --- | --- | --- | --- | 
        ✓ |   ✓ |     ✓ | 11 |                   ✓ |              ✓ |       ✓ | 



## Installation

If you'd like to test this package,install it with [npm](https://www.npmjs.com/package/country-picker) run ```npm i country-picker ```

Develop your module like any other ionic 3 & Angular module. Then, run ```npm run build``` to build a local copy.



## Features

   * Automatically select the user's current country using an IP lookup
   * Automatically set the input placeholder to an example number for the selected country
   * Navigate the country dropdown by typing a country's name, or using up/down keys
   * Handle phone number extensions
   * Full validation, including specific error types
   * Retina flag icons
   

## Usage

**app.module.ts**

```

// Import 
import { CountryServiceProvider ,ComponentsModule } from 'country-picker';
import {HttpClientModule} from "@angular/common/http";


@NgModule({
  imports: [
    ...
    
    HttpClientModule, // Put Http module here
    ComponentsModule
  ],
   
  providers: [
    ...
    
    CountryServiceProvider
  ]
})

```


**home.html**

```
  <select-country (onSelectNumber)="getNumber($event)"  (onSelectCountry)="getCountry($event)"></select-country>

```

## Public Methods


**Get Selected Country**
```
<select-country (onSelectCountry)="getCountry($event)"></select-country>
```
```
  getCountry(selectedCountryObject: any){
    console.log(selectedCountryObject)
  }
```

**Get Entered Number**
```
<select-country (onSelectNumber)="getNumber($event)"></select-country>
```
```
  getNumber(enteredNumberObject: any){
    console.log(enteredNumberObject.mobile)
  }
```


**Check Number isValid**
```
<select-country (onSelectNumber)="getNumber($event)"></select-country>
```
```
  getNumber(enteredNumberObject: any){
    console.log(enteredNumberObject.isValid)
    // isValid is return in boolean form as true | false
  }
```


## Options

**Hide Placeholder Number**

* Type: ```Boolean``` Default: ```true```

* To hide the country example number as placeholder pass the Boolean value 'false' as [isPlaceholder]="false".

```
<select-country [isPlaceholder]="false"></select-country>
```

**Hide user's country**

* Type: ```Boolean``` Default: ```true```

* this plugin is use IP address for lookup to set the default country to the user's country. For to disable geoIpLookup mode pass the Boolean value 'false' as [isGeoIpLookup]="false".

```
<select-country [isGeoIpLookup]="false"></select-country>
```

## License

MIT © [Canopas](https://canopas.com/)

---
_Source: https://npm.io/package/country-picker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
