Compatibility with Ivy
As explained here, the npm package currently does not run in Ivy due to CommonJS/UMD not supported.
Error: There is no format with import statements in '../node_modules/angular2-signaturepad' entry-point.
Would you please give a go at ng-packagr so that your npm package is compatible?
Looks like it'll be fixed by https://github.com/angular/angular/pull/30200 You might still want to check ng-packagr and see if you like the output :)
Although https://github.com/angular/angular/pull/30200 did not fix it, https://github.com/angular/angular/pull/30591 should.
After applying upstream's change, we get the following message:
ERROR in Cannot read property 'getText' of null
Back to troubleshooting then.
Hi there! No one has a solution for this?
We ran into this as well after updating to Angular 9 with Ivy enabled. We were using the latest package available, 2.11.0. Everything was working fine before the upgrade, and we didn't change anything related to our components using SignaturePad. Debugging through our component, which we have setup according to the readme
@ViewChild(SignaturePad) signaturePad: SignaturePad;
ngAfterViewInit() {
// this.signaturePad is now available
this.signaturePad.set('minWidth', 5); // set szimek/signature_pad options at runtime
this.signaturePad.clear(); // invoke functions from szimek/signature_pad API
}
in ngAfterViewInit, this.signaturePad is always undefined now, which seems to be the same problem previously reported.
I've done some light digging and don't see any obvious reason for this. I finally tried just embedding the complete code for signature-pad.ts into our app and using that component instead of the one from NPM and it works fine.
I'm not super familiar with how this project is being built for publishing to NPM but perhaps the package dependencies and or build tools need some updating in order for this to work with Ivy?
"angular2-signaturepad": "2.11.0" is dependent on "signature_pad": "2.3.2"
In package.json, we simply force the dependency:
"signature_pad": "3.0.0-beta.3"
And it works. I'm not sure about your exact issue, but give it a try :)
Thanks for the suggestion. I tried forcing that dependency but still get the same issue.
ERROR TypeError: Cannot read property 'set' of undefined
at MyComponent.ngAfterViewInit (my.component.ts:72)
Curious how your solution fixes any issues. In using my own copied version of signature-pad.ts which works, I removed the reference to "angular2-signaturepad": "2.11.0" and replaced it with "signature_pad": "2.3.2" and everything seems to be working fine.
for me the fix was changing the import of the component from
import { SignaturePad } from 'angular2-signaturepad/signature-pad';
to
import { SignaturePad } from 'angular2-signaturepad';
@joaqcid Thank you!
Your suggestion fixed the problem
@joaqcid i tried this but it is saying that angular2-signaturepad has no exported member signaturePad
@KunalBurangi hmm, weird
@joaqcid i tried this but it is saying that angular2-signaturepad has no exported member signaturePad
Same issue here
this is what i have in my code import { SignaturePad } from 'angular2-signaturepad';
can you provide more information?
@joaqcid the fix didn't work for me as it still sees the signature pas as undefined. It says that it's not compatible with angular Ivy. Any recommendations ?
do you see folder __ ivy... __ under node_modules/angular2-signaturepage

if not, you might need to run ngcc on your dependencies