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

Doesn't work on input file? #24

Closed
adamkarb opened this issue Jun 25, 2015 · 7 comments
Closed

Doesn't work on input file? #24

adamkarb opened this issue Jun 25, 2015 · 7 comments

Comments

@adamkarb
Copy link

I was hoping this would work on a form I have that also has an input=file tag, but it does not seem to track that input. All other input types are working. Let me know if I am doing something incorrectly please.
Thanks

@slavafomin
Copy link
Member

Hello @adamkarb!

I've not designed this module to work with input[file]. Could you describe your use case and explain how you expect it to behave?

Thanks.

@adamkarb
Copy link
Author

I was hoping to test against whether or not the form has been changed, and that would prevent the user from leaving the page without saving changes or confirming exit. It is just a problem since there are input files in the form as well.

@slavafomin
Copy link
Member

I see. I will try to come up with the solution. Will get back to you soon. Thanks for your report.

@slavafomin
Copy link
Member

I'm sorry Adam, but it looks like input[file] input type is not supported by the ngModel directive. input-modified is based on model directive in order to work and will not work without it. Probably we could create a "shim", but I think it will be out of scope for input-modified.

There are two options for you here:

  1. Implement an ngModel directive for input[file] yourself. input-modified should work on top of it if you will stick to the ngModel original interface.
  2. Use some additional checks in your application code to detect uploaded, but not saved, files.

I will try to look into this issue in the future, but I couldn't give it a high priority right now.

@adamkarb
Copy link
Author

Yea I hacked my way through it. I'm no javascript expert but it would be cool if angular had some built in way to work around it.

@slavafomin
Copy link
Member

Hey! I'm glad to hear that you've managed to overcome this limitation. It would be great if you will be able to share your solution here with others in case someone else in the future will stumble upon this )

@adamkarb
Copy link
Author

I watched them via the jQuery .change() method. If they changed, I set a variable to true that was checked later on before the user changes states.

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

No branches or pull requests

2 participants