node.js - Angular 2 - Import html2canvas -
i have installed html2canvas
on angular 2
project using npm install html2canvas --save
. if go file , write import * html2canvas 'html2canvas'
gives error:
cannot find module 'html2canvas'
my package file looks this:
{ ... "scripts": { ... }, "dependencies": { ... "html2canvas": "^0.5.0-beta4", ... }, "devdependencies": { ... } }
the file on i'm trying import html2canvas
is:
import { injectable } '@angular/core'; import * jspdf 'jspdf'; import * html2canvas 'html2canvas'; @injectable () export class pdfgeneratorservice { ... }
since angular2 uses typescript, need install typescript definition files module.
it can installed @types
(if exists). if doesn't can create own definition file , include in project.
Comments
Post a Comment