arkon / ng-inline-svg

[Inactive] Angular directive for inserting an SVG file inline within an element.
https://echeung.me/ng-inline-svg/
MIT License
210 stars 88 forks source link

Possible solution for styles overwriting themselves? #68

Closed gethinoakes closed 6 years ago

gethinoakes commented 6 years ago

If you use multiple SVG icons on the same page that have been exported from applications such as Adobe XD/Illustrator, their styles end up conflicting with each other.

One way around this is to go into each SVG's code and add a prefix to each style. I was wondering if that could be done with this library? Some property such as prefixClass perhaps?

I'll try and have a look at your code when I have more time, but do you think this would be viable as the creator?

arkon commented 6 years ago

do you think this would be viable

Yes, but it would be more so along the lines of a lifecycle hook that I suggested in another issue. I'll try to get around to adding that soon.

gethinoakes commented 6 years ago

Great, I did see that and thought it could also work for this. Thanks for the quick response.

arkon commented 6 years ago

Added [onSVGLoaded] in v6.2.0, which you can use to manipulate the SVG element prior to it being inserted.

(Note that it doesn't work with symbols currently)