angular2-img-cropper icon indicating copy to clipboard operation
angular2-img-cropper copied to clipboard

EXCEPTION: Cannot set property 'original' of undefined

Open firaskudsy opened this issue 8 years ago • 4 comments

I tried to use the Customizing Image cropper code, but am getting this error

EXCEPTION: Cannot set property 'original' of undefined

Any Idea ?

firaskudsy avatar Feb 18 '17 16:02 firaskudsy

Maybe you don't use Image field in your component? This is a workaround for now.

akliuiko avatar Feb 20 '17 10:02 akliuiko

Can you please paste a snippet on how are you using it?

cstefanache avatar Mar 09 '17 15:03 cstefanache

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);
}

akliuiko avatar Mar 09 '17 18:03 akliuiko

solved?

wmattei avatar Jan 12 '18 21:01 wmattei