Hi,
I have the below code but I have an error not understading how to solve it.
Element implicitly has an 'any' type because expression of type '"image"' can't be used to index type 'Object
here is the code:
imageObj: File;
imageUrl: string;
constructor(private imageUploadService: UploadService) {}
onImagePicked(event: Event): void {
const FILE = (event.target as HTMLInputElement).files[0];
this.imageObj = FILE;
}
onImageUpload() {
const imageForm = new FormData();
imageForm.append('image', this.imageObj);
this.imageUploadService.imageUpload(imageForm).subscribe(res => {
this.imageUrl = res['image'];
});
}
the error is in the last line of code:
this.imageUrl = res['image'];