Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete Image Error #208

Open
tawsif93 opened this issue Jun 6, 2018 · 16 comments
Open

Delete Image Error #208

tawsif93 opened this issue Jun 6, 2018 · 16 comments

Comments

@tawsif93
Copy link

tawsif93 commented Jun 6, 2018

When Image Limit completed, then only the clear button is visible. If I remove all the images or A single image, I'm getting an error from the component. Also, delete event is not fired.

UploadDocumentComponent.html:18 ERROR TypeError: Cannot read property 'nativeElement' of undefined at ImageUploadComponent.deleteAll (image-upload.component.js:85) at Object.eval [as handleEvent] (ImageUploadComponent.html:27) at handleEvent (core.js:13589) at callWithDebugContext (core.js:15098) at Object.debugHandleEvent [as handleEvent] (core.js:14685) at dispatchEvent (core.js:10004) at eval (core.js:10629) at HTMLButtonElement.eval (platform-browser.js:2628) at ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:4751)

@majidnk01
Copy link

Yes same issue here... I don't know it's good practice or not (of course not :) ) but it solved my issue by commenting out this line in ImageUploadComponent.prototype.deleteFile

this.inputElement.nativeElement.value = '';
in

/node_modules/angular2-image-upload/lib/image-upload/image-upload.component.js

@tawsif93
Copy link
Author

tawsif93 commented Jun 7, 2018

@majidnk01 Obviously its not a good approach, when you are working remote. It will solve my current development problem but will cause problem for others.

@clap8
Copy link

clap8 commented Jun 7, 2018

Same issue on Angular 6 with your last version.

@ramajd
Copy link

ramajd commented Jun 24, 2018

I found a workaround for this issue, just call contents of deleteAll() method directly in your code:

...
@ViewChild('logoUploader') logoUploader: ImageUploadComponent;
...
// this.logoUploader.deleteAll();
this.logoUploader.files.forEach(f => this.logoUploader.removed.emit(f));
this.logoUploader.files = [];
this.logoUploader.fileCounter = 0;
...

@MarwaAbuEssa
Copy link

the same here

@Xhamps
Copy link

Xhamps commented Jul 16, 2018

I've the same problem. Think had resolved this problem but no published in the npm yet.

@felipefialho
Copy link

Publish it on npm, please

@tawsif93
Copy link
Author

@aberezkin , @UncleDave Can you please publish this update?

@xpvo
Copy link

xpvo commented Aug 1, 2018

I'm having the same issue and it hasn't been published on npm yet!

@Taylorsuk
Copy link

Taylorsuk commented Aug 10, 2018

Same here +1 however only when the [max] property is set. If this is left off then it works fine?!

@josemmarneca
Copy link

The problem is the parameter [max]="xxxxx"
I solve my problem, remove the parameter and add the parameter [beforeUpload]="onBeforeUpload".
private fileCounter = 0;

onBeforeUpload = (metadata: UploadMetadata) => {
if (this.fileCounter >= xxx) {
metadata.abort = true;
} else {
this.fileCounter++;
}
return metadata;
};

@olesea
Copy link

olesea commented Aug 24, 2018

Publish it on npm, please

@Rehan1579
Copy link

facing same issue. Please update !

@raydvard
Copy link

And after one picture removing, If we select new picture nothings happens afterwards.
Please fix this issue.

@meyer20
Copy link

meyer20 commented Oct 3, 2018

+1

@emouawad
Copy link

Having same issue

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests