adobe-webplatform / Snap.svg

The JavaScript library for modern SVG graphics.
http://snapsvg.io
Apache License 2.0
13.94k stars 1.15k forks source link

Snap.svg and Angular2 #548

Open AliObaji opened 7 years ago

AliObaji commented 7 years ago

So I've read alot about the problem, but I haven't seen an official solution posted. I've created an angular-cli project. And ran 'npm install snapsvg -s', then I imported it in my component using "import 'snapsvg' ". But I get this error when trying to load: "Uncaught TypeError: Cannot read property 'on' of undefined" Can you please post an official solution to this problem ?

Hesesses commented 7 years ago

I would also like to know how to use this on angular4

Asele commented 7 years ago

I have no idea if it is official solution or not but for me using https://github.com/geelen/Snap.svg-cjs worked like a charm. you can install this package with npm and use it in place of raw snapsvg. cjs uses raw version as a dependency anyway. here is a working example (also for angular4): https://github.com/stevefarwell/angular2-snapsvg-demo

drwpow commented 7 years ago

See #483