Model is being reset when the "click to select" area is clicked #761

Closed
papaiatis opened this Issue May 25, 2015 · 6 comments

Projects

None yet

3 participants

@papaiatis

I have this issue both in my code and also in the demo (https://angular-file-upload.appspot.com/).
The scenario is:
I upload an image by clicking on the "click to select" area and choose an image from the dialog. The image is uploaded after a couple of seconds. When it's uploaded and I click on the "click to select" area again, the preview is removed and the model behind is reset.
Expected behaviour: the preview is not removed even if I choose "Cancel" in the dialog.

Is this possible to achieve by configuring this component somehow?

@danialfarid
Owner

There is no consistent cross browser way to detect choosing "Cancel" on the dialog. So the model is being reset on click to allow selecting the same file again and to remove the file if the user cancels the popup.

@kishankanugula

Is there any workaround for this problem? I have a use-case for multiple uploads, say i have uploaded 3 images and previewing it and now i want to add another image and when i click upload button(even if i click "Cancel") again it reset's the model and i need to upload again all the previous images again.

@danialfarid
Owner

@kishankanugula if you want to keep the selected files you can add the selected files to another scope variable and have your preivew to show files from that scope variable instead of the one that is attached to the file input.

@kishankanugula

@danialfarid Thanks for your answer. I am already doing the same.Its not neat so thght there is a better way of doing it through configurations.

@danialfarid danialfarid closed this Jun 4, 2015
@danialfarid danialfarid reopened this Jun 4, 2015
@danialfarid danialfarid pushed a commit that referenced this issue Jun 4, 2015
Danial Farid Fixed #783 #764 #777 #766 #763 #761 #721 #687 #650 #710 #784 #768 #789 39fa784
@danialfarid
Owner

@kishankanugula
Since version 5.0,0 you can use ngf-keep.

@papaiatis
You can play with ngf-reset-on-click and ngf-reset-model-on-click since version 5.0,0
but make sure you test on different browsers.

@danialfarid danialfarid closed this Jun 4, 2015
@kishankanugula

@danialfarid : Thank you for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment