mercredi 24 août 2016

How do I make jsPDF accessible in my Ember app?

I'd like to export PDF documents using jsPDF in an Ember app, but I can't figure out how to make the library available within the app.

So far, I've installed the library using bower:

bower.json

{
  "name": "myApp",
  "dependencies": {
    ...
    "jspdf": "~1.2.61"
  }
}

...and imported it in the ember-cli-build.js file:

ember-cli-build.js

...
app.import(app.bowerDirectory + '/jspdf/dist/jspdf.min.js');
...

However, when I try to use it (by calling var doc = jsPDF.new() in an Ember action), I get this:

ReferenceError: jsPDF is not defined

What am I missing?




Aucun commentaire:

Enregistrer un commentaire