I don't know how to use Snap.svg with Angular v4.0, so I read this post. I tried the solution of @moeabdol (npm install
..., scripts:
..., declare
..., s.circle(...)
), but I get the following error:
ERROR TypeError: s.circle is not a function
However, I can load an external SVG with Snap.load(...)
.
Why is s.circle
not working for me?
Make sure that you draw on a svg
and not a div
. I made this mistake too.
In your HTML:
<svg id="editor-canvas"></svg>
In your component:
const s = Snap("#editor-canvas");
const c = s.circle(100, 100, 100);