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

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

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

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

papaiatis opened this issue May 25, 2015 · 6 comments

Comments

@papaiatis
Copy link

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
Copy link
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
Copy link

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
Copy link
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
Copy link

@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
Copy link
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.

@kishankanugula
Copy link

@danialfarid : Thank you for the fix.

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

3 participants