angularfrontendsingle-spasingle-spa-angular

SVG 404 not found using Single Spa and Angular


When I refresh the page, I see in network that there is an error of 404 not found for the svg.

I'm trying to import an svg from an external file in assets/icons, like this.

<img src="../assets/icons/save.svg" />

The path is correct, but when I refresh the page, I see in network that there is an error of 404 not found for the svg. I also putted the path in angular.json but still not work.

I'm in Single Spa and using Angular. Thanks in advance!


Solution

  • I just used another way to import image, using ID on container and import the svg from css:

    #logo {
        background-image: url('../assets/icons/save.svg');
        width: 20px;
        height: 20px;
    }
        <div id="logo"></div>