2.0.6 • Published 6 years ago

ngx-country-select v2.0.6

Weekly downloads
74
License
MIT
Repository
github
Last release
6 years ago

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

      "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:

$ 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:

$ npm install ngx-country-select --save

and then from your Angular AppModule:

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:

<!-- 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:

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:

$ npm run build

To lint all *.ts files:

$ npm run lint

License

MIT © Nikolas Pafitis

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

1.2.16

7 years ago

1.2.15

7 years ago

1.2.14

7 years ago

1.2.13

7 years ago

1.2.12

7 years ago

1.2.11

7 years ago

1.2.10

7 years ago

1.2.9

7 years ago

1.2.8

7 years ago

1.2.7

7 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.0.0

7 years ago