Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Cannot bind to <input type="file"> #672

Closed
dloehr opened this issue Nov 23, 2011 · 9 comments
Closed

Cannot bind to <input type="file"> #672

dloehr opened this issue Nov 23, 2011 · 9 comments

Comments

@dloehr
Copy link

dloehr commented Nov 23, 2011

Under angular 0.9.19, I could bind to a file input (using the name attribute) and get the name of the selected file. This allowed me to disable my submit button until a file was selected.

In angular 0.10.5, I tried using ng:model on the file input, but it made the appear as a regular text input.

@dloehr
Copy link
Author

dloehr commented Nov 23, 2011

Actually, it looks like the binding still works through the name attribute, but $digest isn't called automatically when the <input type="file"> is changed.

@IgorMinar
Copy link
Contributor

is this still an issue in rc2? can you please create a jsfiddle?

(this might be related to #757)

@dloehr
Copy link
Author

dloehr commented Mar 24, 2012

It seems to be fixed now.

In Safari (5.1.4, Windows), I had to add ng-model-instant (http://jsfiddle.net/8Tys7/) to the <input type="file"> for it to work, so anyone intending to use binding on file inputs should keep this in mind (or maybe ng-model-instant could be the default for file inputs?)

@mathpere
Copy link

mathpere commented Jul 3, 2012

unfortunately, adding "ng-model-instant" doesn't work with angular 1.0.1

@filipesperandio
Copy link

Any news?
1.0.0rc2 works: http://jsfiddle.net/jtzUE/2/
1.0.1: doesn't: http://jsfiddle.net/jtzUE/1/

@RyanQuackenbush
Copy link

Has this issue been resolved with another fix?

@guruward
Copy link

Is there any work around. ? for now 1.0.2 does not solve the issue either

@filipesperandio
Copy link

I do use an approach suggested by AngularUI team (
http://angular-ui.github.com/), which is basically bind an event to the
input file:

It depends on AngularUI code, so you have to include it on your project.

For more info on this approach look for Event Binder on the website above.
This approach is working fine for me.

Cheers!

On Tue, Sep 18, 2012 at 11:29 AM, Stephen Ward notifications@github.comwrote:

Is there any work around. ? for now 1.0.2 does not solve the issue either


Reply to this email directly or view it on GitHubhttps://github.com//issues/672#issuecomment-8656618.

Filipe Gomes Esperandio

Gtalk: fiilipesperandio@gmail.com
Skype: filipesperandio
Mobile: +55 51 8446-7547

@pkozlowski-opensource
Copy link
Member

Closing as duplicate of #1375

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

No branches or pull requests

7 participants