Closed defra91 closed 7 years ago
Well I figured it out by myself. Image
is a standard javascript object:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image
Furthermore I was having issues compiling in production with webpack. Typescript could not find Image
class and so webpack compilation failed. I fixed removing completely the Image
reference and replaced with another solution, like in this post: https://stackoverflow.com/questions/25203906/typescript-new-image-from-global-scope
public readUrl(event: any) {
if (event.target.files && event.target.files[0]) {
let image = document.createElement('img');
let file = event.target.files[0];
let reader: FileReader = new FileReader();
reader.onloadend = (loadEvent: any) => {
image.src = loadEvent.target.result;
this.image = image;
this.openImageCropModal();
}
reader.readAsDataURL(file);
}
}
I noticed that in the example a class named
Image
is used:It works perfectly but my linter is complaining about
Image
class which is not declared or defined anywhere. Any suggestion?