Typescript | TypeError: __WEBPACK_IMPORTED_MODULE_1_signature_pad__ is not a constructor

Viewed 1934

I'm currently working on an Angular2 project and I'm trying to use a JS library (https://github.com/szimek/signature_pad) for signature input.

I've tried using the library as is, with my code as follows:

// .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>

and I get the following error when I launch the browser page: ERROR Error: Uncaught (in promise): TypeError: WEBPACK_IMPORTED_MODULE_1_signature_pad is not a constructor

I've also tried using dimpu's angular2-signature-pad, but the same error essentially comes up.

1 Answers
Related