Currently, I am working on a project using Angular2 and attempting to incorporate a JS library for signature input from https://github.com/szimek/signature_pad.
In my code, I have tried utilizing the library in the following way:
// .ts file
import * as SignaturePad from 'signature_pad';
export class ... {
private signaturePad: SignaturePad;
ngOnInit() {
let canvas = document.querySelector("canvas");
this.signaturePad = new SignaturePad(canvas);
}
}
.
// .html file
<div...>
<canvas></canvas>
</div>
However, when I launch the browser page, I encounter an error message: ERROR Error: Uncaught (in promise): TypeError: WEBPACK_IMPORTED_MODULE_1_signature_pad is not a constructor
I also attempted to use dimpu's angular2-signature-pad, but encountered the same error.