You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.
I'm looking to include a SVG sprite sheet on the page once and then use the symbol method to reference individual icons (to improve performance) per your README documentation and the CSS Tricks article (https://css-tricks.com/svg-symbol-good-choice-icons/).
I believe that change removes the symbol id from the SVG path, so if there's no SVG path, all that's left is an empty string leading eventually to the Error: No SVG found in loaded contents error downstream.
The text was updated successfully, but these errors were encountered:
The SVG needs to be available on the page prior to the symbol ID being referenced.
If you look at the demo in this package, it's just placed in the static HTML directly, but you should be able to put it in an Angular template as you see fit too.
It seems to work fine if the sprite sheet is added directly to the index.html file like in the demo. If it's in an Angular template then I always get the Error: No SVG found in loaded contents, regardless of whether the sprite sheet is in a parent template like app.component.ts or if it's in the same template as the icon itself. Am I missing something?
Would definitely prefer to include the sprite sheet in a template -- it would make it much easier to write tests and mean that I could load a sample sprite sheet alongside a demo of the component (e.g. if I use it in a Storybook-type of environment) without having to have magic configuration in some other separate file.
I haven't tried recently and I don't really remember if I ever did a few years back. It's possible that it might require an extra tick for Angular to actually render the template (with the SVG) first before the directive can actually find it in the DOM.
I admittedly haven't used Angular in years though, so there may be better ways of doing it now.
I'm looking to include a SVG sprite sheet on the page once and then use the symbol method to reference individual icons (to improve performance) per your README documentation and the CSS Tricks article (https://css-tricks.com/svg-symbol-good-choice-icons/).
For example, in app.component.html:
Then, in icon.component.html (similar to the example in your npm/README documentation):
The above in icon.component.html does not work. I receive the error:
Error: No SVG found in loaded contents
However, I can add a symbol id to a file path, like so:
That works fine, but it injects the symbol alongside the
use
element for every icon at runtime. This lowers performance significantly.ng-inline-svg version: 11.0.1
Browser: Chrome 86.0.4240.111
The problem seems to be from the latest release:
I believe that change removes the symbol id from the SVG path, so if there's no SVG path, all that's left is an empty string leading eventually to the
Error: No SVG found in loaded contents
error downstream.The text was updated successfully, but these errors were encountered: