2

Trying to take advantage of using the assets directory provided by angular, by using it to import svgs.

I want to import the svg file path into the xlink attribute such as this post.

<svg>
  <use
    xlink:href="assets/img/logos/extant_logo_banner_favicon.svg"
  ></use>
</svg>

The result is that the svg isn't rendered and no errors are shown in the console. I inspected the svg that contains the use tag and it shows that the shadowroot under the use tag is empty.

I know that the path is correct because I tested an image element that uses that svg and it works

<img src="assets/img/logos/extant_logo_banner_favicon.svg" alt="" />

I'm using angular 7.2.15

Caleb Taylor
  • 2,670
  • 2
  • 21
  • 31

0 Answers0