Open WeekendMan opened 7 years ago
this is because when you image.src = fileReaderEvent.target.result; image is still not ready before the onload event fires. so try this way
..
if (wrapper) {
let image: any = new Image();
image.onload = function() {
this.cropper.setImage(image);
}
image.src = fileReaderEvent.target.result;
}
@kim-cph your solution not working for me
it happened to me when I removed the this.data = {}; of the constructor, just add it again.
@WeekendMan did you solve the problem, I am facing the same problem in 0.9.0 version in angular 4.4.6. any solution?
I have fixed with @ViewChild(ImageCropperComponent) cropper:ImageCropperComponent;
. now its working for me
I'm trying to show user image to crop it after drop event and I'm getting the error (Angular2):
EXCEPTION: Cannot read property 'setImage' of undefined
This is my component:
This is my template of this component: