Skip to content

binarydharma/ngx-flag-picker

 
 

Repository files navigation

How to use

Add a link tag with flag-icon-css library to your index.html file.

Add NgxFlagPickerModule to your module in the import section.

After:

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  template: `
    <ngx-flag-picker
      [selectedCountryCode]="selectedCountryCode"
      [countryCodes]="countryCodes"
      (changedCountryCode)="changeSelectedCountryCode($event)">
    </ngx-flag-picker>
    <h1>{{ selectedCountryCode }}</h1>
  `
})
export class AppComponent {
  selectedCountryCode = 'us';
  countryCodes = ['us', 'lu', 'de', 'bs', 'br', 'pt'];

  changeSelectedCountryCode(value: string): void {
    this.selectedCountryCode = value;
  }
}

Input parameters:

Name Type
selectedCountryCode string
countryCodes string[]
customLabels Record<string, string>
showFlags boolean
showLabels boolean
showArrow boolean

Output parameters:

Name Type
changedCountryCode EventEmitter<string>

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 61.6%
  • HTML 17.9%
  • JavaScript 15.7%
  • SCSS 4.8%