typescript - Using external library with angular cli -


i have installed 1 3rd party module jspdf angular app. module works error in console:

cannot find module '../../../node_modules/jspdf/dist/jspdf.min.js'.

what did:

  1. install module via npm:

npm install mrrio/jspdf --save

  1. import module in component:

import * jspdf '../../../node_modules/jspdf/dist/jspdf.min.js';

  1. then works module in component.

is missing here?

have @ instructions here: github.com/angular/angular-cli#3rd-party-library-installatio‌​n.

if jspdf (or other library) needs in global scope, need add js file apps[0].scripts in angular-cli.json file, webpack bundles if loaded <script> tag. if that, can @ adding declare var jspdf: any; in src/typings.d.ts or component.

however, looks there typings jspdf npmjs.com/package/@types/jspdf can include after running npm install --save-dev @types/jspdf; should able import { jspdf } 'jspdf'; in component.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -