Can someone please explain how to use html2canvas properly with Angular 2?
It can be installed with npm install html2canvas
but it does not contain any TypeScript code.
@niklasvh , will you provide a version we can easily use with Angular 2?
Check this answer
Here
Any news please? did someone fix this issue?
@Tarek-Adra Sorry that link didn't work for me.
/Applications/MAMP/htdocs/html5-banner/src/app/selected-banner/selected-banner.component.ts (64,10): Argument of type '{ onrendered: (canvas: any) => void; }' is not assignable to parameter of type 'Html2CanvasOptions'.
Object literal may only specify known properties, and 'onrendered' does not exist in type 'Html2CanvasOptions'.
I'm using with Ionic2 + Angular 2.
import * as html2canvas from 'html2canvas';
And use like:
myClickFunction( event: any ){
html2canvas( event.target )
.then((canvas) => {
console.log( canvas );
})
.catch(err => {
console.log("error canvas", err);
});
}
I am trying this in Angular 4 and I get below error:
Uncaught (in promise): Error: Can't resolve all parameters for ImageService: (?).
I have installed the typings from "@types/html2canvas"
@jaichandra
I am also seeing something similar using Angular 5. Trying to build a minimum test case at the moment.
Most helpful comment
I'm using with Ionic2 + Angular 2.
And use like: