Open khitrukhina opened 2 years ago
Which plugin or library did you used for select box? May be the plugin issue?
It's angular material )
Could you show your code here? It work fine for me.
<mat-form-field appearance="fill">
<mat-label>Country Codes</mat-label>
<mat-select>
<mat-option *ngFor="let list of countryLists" [value]="list.dial_code">
{{list.flag}} {{list.dial_code}}
</mat-option>
</mat-select>
</mat-form-field>
import { Component } from '@angular/core';
//@ts-ignore
import CountryList from 'country-list-with-dial-code-and-flag'
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'my-app-angular';
countryLists = CountryList.getList();
}
Maybe you have met some unexpected behaviour with emojis?)
It's Windows problem. Everyone who has linix/mac - sees emoji. Windows - no.
There are svg and png format available here in this repo. May be you can download and use in your code.
Have used this polyfill https://www.npmjs.com/package/country-flag-emoji-polyfill
Removed pollyfill as its working only with cdn.
Resolved like this:
angular.json
{ "glob": "**/*", "input": "./node_modules/country-list-with-dial-code-and-flag/assets/png", "output": "assets/flags" }
component: ` readonly countriesList = countryList.getList().map(country => { const pathName = country.code.toLowerCase(); if (pathName === 'an') { return country; }
country.path = `./assets/flags/${pathName}.png`;
return country;
});`
New version 4.0
now support svg.
https://www.npmjs.com/package/country-list-with-dial-code-and-flag/v/4.0.0
import CountryFlagSvg from 'country-list-with-dial-code-and-flag/dist/flag-svg'
const myanmar = CountryList.findOneByCountryCode('mm')
if(myanmar) {
const flagSvg = CountryFlagSvg[myanmar.code] // .js
const flagSvg = CountryFlagSvg[myanmar.code as never] // .ts
console.log(flagSvg) // it return svg string
}
I see, that you've already answered on issues like that, but it IS here. They are partially displayed. And when they are not, the text is displayed. Like on the attached screenshot. I am using Angular.