Search code examples
angularangular-material

angular-material-extensions/select-country - Cannot get the resource


I'd like to use the extension, angular-material-extensions/select-country. The installation instruction comes from here, https://github.com/angular-material-extensions/select-country.

I did follow the instruction: installing via npm, and the result looks like this

enter image description here

as you can see, it cannot show the corresponding country flag. I got the error

ERROR Error: Error retrieving icon :zm! Http failure response for http://localhost:4200/assets/svg-country-flags/svg/zm.svg: 404 Not Found

I guess the problem that the app cannot find out where the images are located. But I do not really know how to fix this.


Solution

  • Looks like there is an error in library documentation with path. Angular 12.

    In angular.json I fixed path and flags started to show correctly:

        "assets": [
          "src/favicon.ico",
          "src/assets",
          {
            "glob": "**/*",
            "input": "./node_modules/svg-country-flags/svg",
            "output": "/assets/svg-country-flags/svg"
          }
        ],