title: QuaggaJS with Angular 2 problems
body: <p>I'm trying to use QuaggaJS with Angular 2. I have the quagga.d.ts file in the app folder and the following import statements in the component:</p>
  
  <pre><code>import Quagga from './quagga.d';
  </code></pre>
  
  <p>The guide says from 'quagga' but it doesn't work but above works</p>
  
  <pre><code>declare const Quagga = require('quagga').default;
  </code></pre>
  
  <p>I have the following code in the constructor of the component like this:</p>
  
  <pre><code>constructor() { 
  
      Quagga.init({
      inputStream : {
        name : "Live",
        type : "LiveStream",
        target: document.querySelector('#yourElement')    // Or '#yourElement' (optional)
      },
      decoder : {
        readers : ["code_128_reader"]
      }
    }, function(err) {
        if (err) {
            console.log(err);
            return
        }
        console.log("Initialization finished. Ready to start");
        Quagga.start();
    });
  
  
   }
  </code></pre>
  
  <p>However, I get the following error:</p>
  
  <p><code>Uncaught (in promise): Error: Error in :0:0 caused by: Cannot read property 'init' of undefined</code> from core.umd.js</p>
  
  <p>and </p>
  
  <pre><code> Uncaught (in promise): Error: Error in :0:0 caused by: Cannot read property 'init' of undefined
  TypeError: Cannot read property 'init' of undefined
  </code></pre>
  
  <p>from zone.js</p>
  
  <p>What does this error mean? I can't figure this out! Is there a bug with zone.js?</p>
  
  <p>Any help would be greatly appreciated!</p>