How to use Snap.svg with Angular v4.0 -


i don't know how use snap.svg angular (created angular-cli). i've tried call snap.svg in index.html cdn, import in component adding : import 'snapsvg' message :

uncaught typeerror: cannot read property 'on' of undefined

any idea ?

edit

import :

import 'snapsvg' 

template :

<svg id="test" width="100%" height="100%" viewbox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;">   <path d="m84.403,145.423c65.672,64.179 136.318,0 136.318,0" /> </svg> 

in component :

  ngoninit() {     let s = snap('#test')     this.path = s.path(this.start)     this.path.animate({       d: this.end     }, 1000, mina.bounce)   } 

currently there seems a bug using snapsvg webpack (which angular-cli uses). far way i've got work including snapsvg.js file script in angular-cli.json . add scripts array below:

"scripts": [ "node_modules/snapsvg/dist/snap.svg.js"],  

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -