Closed erdaepfel5 closed 3 years ago
hi @erdaepfel5 so after 2.0.3 remove does not work? Did you mean removeFile(file: File)?
Hi Ivan,
Yes, that's what I have encountered. Can you reproduce in 2.0.4 or higher version?
Best regards, Isabella
Ivan notifications@github.com schrieb am Mo., 8. März 2021, 12:13:
hi @erdaepfel5 https://github.com/erdaepfel5 so after 2.0.3 remove does not work?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pIvan/file-upload/issues/52#issuecomment-792683459, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMRDARHXWVR3KPNZM45EZTTTCSWOPANCNFSM4YZFV4SA .
Hi Isabella,
on the demo, each delete button uses the same method removeFile
, and
all works fine. There is also a test in control.class.spec.ts
which passes every time.
i will try version 2.0.0+ later. Kind regards, Ivan
Versions I just tested are 2.0.4, 2.0.5, 2.0.6, and 2.0.7 and all works fine
Code used in test:
Can you give me an example of code where the mentioned problem is? Thanks!
Kind regards, Ivan
Hi Ivan, I have analysed further and the issue we face is because of your fix in 2.0.4 "file deletion - Fixed error with preventing files deletion when control is disabled". What we do is limiting the number of files to 1. As soon as a file is choosen we disable the fileControl, so that the upload button is hidden. This also disables the Remove button since 2.0.4. Is it possible to only hide the upload button and have the Remove available?
We would like to have it displayed that way, when a file is choosen:
While this happens since 2.0.4, as I need to keep fileControl enabled, otherwise Remove is not working
Thanks, Isabella
PS: It seems your "Disable / enable multiple" button is not working on https://pivan.github.io/file-upload/ as it always allows to choose multiple files
Hi Isabella,
thank You for pointing me that disable/enable multiple has stopped to work, I have made some changes in version 3.0.0 where initially is possible to define Control settings, and I have made some mistake. Fix for this issue is up with version 3.1.1. Also, a test was written for this case.
Thanks, Ivan
Hi Isabella, can you confirm is it ok now? Please check the flag discard invalid.
Thanks, Ivan
Hi Ivan, the multiple files issue seems good. Thanks for the fix.
Do you think you can provide a solution for my request for having e.g. a flag to hide the upload icon while remove is still working?
Hi Isabella,
it is possible to do samething like this:
public fileUploadControl = new FileUploadControl( { discardInvalid: true }, [FileUploadValidators.filesLimit(1)] );
or to use a custom template.
Hi @erdaepfel5 di I helped you?
Hi Ivan, Sorry, for the very late reply. I had to focus on other work but had a look at it now again. Unfortunately, discardInvalid or other config did not help to solve my problem.
What I did now is css styling. I will add here in case someone else also needs such a solution:
private filesControl = new FormControl(null, [FileUploadValidators.filesLimit(1), FileUploadValidators.accept(this.allowedFileTypes)]); public uploadForm = new FormGroup({ files: this.filesControl }); toggleStatus(): void { if (this.filesControl.value.length === 0) { this.hideIcon = false; } else { this.hideIcon = true; } }
&.hide-icon { .upload-input { display: none; } }
We have upgraded from Angular 8 to 11 including this lib from 1.5.2 to 2.0.9. Since then the Remove is not performing any action. I have tried all versions between 2.0.0 and 3.1.0. It seems to only work until 2.0.3. Can you please check?