I am using the latest version of html2canvas (version 1.0.0-alpha.12) with Angular 6. My typescript function looks like below,
public takeScreenshot(element: ElementRef) {
console.log ('Take screen shot');
html2canvas(element).then(function(canvas) {
const contentData = canvas.toDataURL('image/png');
console.log('successfully took the byte array for screen shot');
});
}
However, i get the following error,
ERROR TypeError: Object(...) is not a function
at ThumbnailService.push../src/services/thumbnail.service.ts.ThumbnailService.takeScreenshot (thumbnail.service.ts:19)
at ScreenDesignerComponent.push../src/components/screen-designer/screen-designer.component.ts.ScreenDesignerComponent.takeScreenshot (screen-designer.component.ts:65)
at Object.eval [as handleEvent] (ScreenDesignerComponent.html:7)
at handleEvent (core.js:10258)
at callWithDebugContext (core.js:11351)
at Object.debugHandleEvent [as handleEvent] (core.js:11054)
at dispatchEvent (core.js:7717)
at core.js:8161
at HTMLDivElement.<anonymous> (platform-browser.js:995)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
Am I doing anything wrong?
how are you importing the html2canvas ? I am using it without issues in an angular 6 project importing it like this import * as html2Canvas from 'html2canvas';
Also probably you would get faster answers to support questions on stackoverflow first.
Most helpful comment
how are you importing the html2canvas ? I am using it without issues in an angular 6 project importing it like this
import * as html2Canvas from 'html2canvas';
Also probably you would get faster answers to support questions on stackoverflow first.