angular2-img-cropper
angular2-img-cropper copied to clipboard
EXCEPTION: Cannot set property 'original' of undefined
I tried to use the Customizing Image cropper code, but am getting this error
EXCEPTION: Cannot set property 'original' of undefined
Any Idea ?
Maybe you don't use Image field in your component? This is a workaround for now.
Can you please paste a snippet on how are you using it?
Of course. I noticed that this error takes place in case when you don't use image variable as your component class member It can be fixed with following snippet:
Image: any; // declare as component class member
//...
fileChangeListener($event) {
this.Image = new Image();
//...
var that = this;
myReader.onloadend = function (loadEvent:any) {
that.Image.src = loadEvent.target.result;
//...
};
myReader.readAsDataURL(file);
}
solved?