select-country icon indicating copy to clipboard operation
select-country copied to clipboard

SVG flags can't be retrieved

Open wadie opened this issue 3 years ago • 7 comments

Describe the bug Created a fresh Angular 9 project with material, getting following error for all flags Error: Error retrieving icon :bl! <svg> tag not found

To Reproduce Steps to reproduce the behavior: Go to https://stackblitz.com/edit/angular-9-material-starter-4fd9kj?file=angular.json I created a stackblitz where you can reproduce the issue. it's a clean Angular 9 installation with material

Expected behavior For the flags to load

wadie avatar Jul 20 '21 15:07 wadie

Experiencing the same with angular 12 and @angular-material-extensions/select-country": "^5.0.1" "svg-country-flags": "^1.2.10" The assets are not copied to the src/assets directory, they remain inside the node_modules directory.

morrowyn avatar Jul 24 '21 14:07 morrowyn

still not fixed i had to copy paste them manually so they work

waelbenmustapha avatar Aug 21 '21 00:08 waelbenmustapha

the problem is with the output path when the svg resources are being copied from the node_modules to the local assets. try changing it to the following setup (in angular.json under assets section):

{
                "glob": "**/*",
                "input": "./node_modules/svg-country-flags/svg/",
                "output": "./assets/svg-country-flags/svg/"
              }

that should solve your problem.

@AnthonyNahas - what's the procedure to contribute to this project, I can open PR

leibovitzgil avatar Aug 21 '21 06:08 leibovitzgil

the problem is with the output path when the svg resources are being copied from the node_modules to the local assets. try changing it to the following setup (in angular.json under assets section):

{
                "glob": "**/*",
                "input": "./node_modules/svg-country-flags/svg/",
                "output": "./assets/svg-country-flags/svg/"
              }

that should solve your problem.

@AnthonyNahas - what's the procedure to contribute to this project, I can open PR

Great Solution, 17/06/22 works

TonyGolem avatar Jun 17 '22 21:06 TonyGolem

a PR would be appreciated 🙏

AnthonyNahas avatar Jun 17 '22 21:06 AnthonyNahas

In my case the problem was with base URL interceptor. So, gentle hint: if svg images are available under assets, check if some interceptor does not modify assets folder URL while loading them. Good luck!

mindarchitect avatar Jul 22 '22 22:07 mindarchitect

Describe the bug Created an Angular 14 project with material, getting following error for all flags handleError Error: Error retrieving icon :af! this.tokenGetter is not a function and no flag loaded for any country.

salmankhaled-egabi avatar Jan 07 '23 20:01 salmankhaled-egabi