matheusdavidson / angular-cropperjs

CropperJS integration for Angular +6
MIT License
109 stars 68 forks source link

ERROR TypeError: Cannot read property 'scale' of undefined #68

Open jinghun1999 opened 2 years ago

jinghun1999 commented 2 years ago

I used this component in ionic3. Another colleague's computer packed apk, no problem. The apk packaged on both of my computers is running with errors。 html file:

<angular-cropper [cropperOptions]="config"
                     (touchstart)="cropperTouchStart($event)"
                     [imageUrl]="imageUrl" #angularCropper></angular-cropper>

and typescript file:

...
@ViewChild('angularCropper') public angularCropper: AngularCropperjsComponent;
...
setTimeout(() => {
    console.log('this.angularCropper', this.angularCropper)
    this.angularCropper.cropper.scale(0.1, 0.1);
}, 500);

then show the error with "Cannot read property 'scale' of undefined"

jinghun1999 commented 2 years ago

my version is v0.1.5 and the cropperjs version is 1.5.2 I can't find any reason for this error as my colleague works well.