# ngx-country-select
Based on the awesome country-select-js by mrmarkfrench(https://github.com/mrmarkfrench/country-select-js)
## Installation
First you need jquery and country-select-js installed.
Import them to your angular-cli file like this
```json
      "styles": [
        "../node_modules/country-select-js/build/css/countrySelect.css",
      ],
      "scripts": [
        "../node_modules/jquery/dist/jquery.js",
        "../node_modules/country-select-js/build/js/countrySelect.js"
      ],
```
To install this library, run:


```bash
$ npm install ngx-country-select --save
```

## Consuming your library

Once you have published your library to npm, you can import your library in any Angular application by running:

```bash
$ npm install ngx-country-select --save
```

and then from your Angular `AppModule`:

```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

// Import your library
import { NgxCountrySelectModule } from 'ngx-country-select';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,

    // Specify your library as an import
    NgxCountrySelectModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
```

Once your library is imported, you can use its components, directives and pipes in your Angular application:

```xml
<!-- You can now use your library component in app.component.html -->
<input #countrySelect="ngx-country-select"
       ngxCountrySelect....>...
```

To select country or get country data manually:
```typescript
import ...
@Component({
  selector: 'app-form',
  templateUrl: './form.component.html',
  styleUrls: ['./form.component.css']
})
export class FormComponent implements OnInit, AfterViewInit {
  @ViewChild('countrySelect') countrySelect;
  setCountry(countryCode) {
    this.countrySelect.setCountry(countryCode);
  }
  getCountryData() {
    return this.countrySelect.getCountryData();
  }
}

```

## Development

To generate all `*.js`, `*.d.ts` and `*.metadata.json` files:

```bash
$ npm run build
```

To lint all `*.ts` files:

```bash
$ npm run lint
```

## License

MIT © [Nikolas Pafitis](mailto:n.pafitis@impactechs.com)
