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

input[type="file"] defaults to textInput directive; conflicts w/ custom directive #6231

Closed
igienger opened this issue Feb 12, 2014 · 3 comments

Comments

@igienger
Copy link

Overview:
File uploads are a complex issue, so AngularJS v1 leaves it up to others to implement:
#1375 (comment)

This hasn't been much of a problem, but recently textInput directive has started clobbering the view value:
a090400

The textInput directive has been applied to file input elements by default for a long time, but since that change it always adds an onchange listener, so depending on directive ordering, the textInput directive's listener can be called last and clobber the view value.

Repro: http://jsfiddle.net/mR3P6/6/

Suggested Fix:
I don't think file input elements should have the textInput directive applied at all. I think it should be a noop, just like the hidden, button, submit, or reset types.

@IgorMinar
Copy link
Contributor

@tbosch can you please look into this?

@IgorMinar IgorMinar added this to the 1.2.13 milestone Feb 12, 2014
@caitp
Copy link
Contributor

caitp commented Feb 12, 2014

This should be fairly easy to fix, but I'm not totally sure how this could be tested. I tend to agree though, it (input[type=file]) really should be noop'd rather than use the textInputType function

@caitp caitp closed this as completed in a9fcb0d Feb 13, 2014
matsko pushed a commit to matsko/angular.js that referenced this issue Feb 14, 2014
textInput shouldn't be applied to file inputs to ease writing of custom file input directives.

This change prevents file inputs from instantiating the text input parser/formatter pipelines.

Closes angular#6247
Closes angular#6231
khepin pushed a commit to khepin/angular.js that referenced this issue Feb 19, 2014
textInput shouldn't be applied to file inputs to ease writing of custom file input directives.

This change prevents file inputs from instantiating the text input parser/formatter pipelines.

Closes angular#6247
Closes angular#6231
@djvs
Copy link

djvs commented May 13, 2014

see a9fcb0d for problems introduced by this change

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