What is this package ?
I created this package since I wanted a way to work with external SVG files, and still be able to change its CSS and scale it as I wished, making the SVG reusable.
If you're interested in some more details about how this works and the code itself, visit this post.
How to use it ?
Very simple.
After you've installed the package, add ngReusableSvg
as a dependency to your module. Now simply use the 'oa-create-svg' directive on an <object>
tag, and specify dimensions. Like this:
<object oa-create-svg
id="my-svg"
data="my_icon.svg"
type="image/svg+xml"
class="svg-class"
height="30"
width="30">
</object>
You can give the object its classes, id, and other attributes which will be placed into the <div>
element that will replace the <object>
.