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

modify readme.md. Document select options hidden workaround #98

Merged
merged 1 commit into from
Feb 10, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,21 @@ In order, for ngUpload to respond correctly for IE, your server needs to return

### uploadSubmit

* `upload-options-convert-hidden`: Set the value of hidden inputs to their `ng-model` attribute when the form is submitted.
* `upload-options-convert-hidden`: Set the value of hidden inputs to their `ng-model` attribute when the form is submitted. One situation in which this is useful is when
using select elements whose options are generated with ngOptions, for
example:
```
select[name='category_id' ng-model='category' ng-options='c.id as c.name for c in categories']
```
and where categories is
```
[{id: 12, name: 'fred'}, {id: 65, name: 'wilma'}]
```
Because Angular will generate options whose HTML element value is indexed on 0, the value submitted will be the value of the
option and not the desired ng-model value which is category.id. Adding
a hidden element whose ng-model matches the ng-model of the select
element, combined with
upload-options-convert-hidden='true' will workaround this issue.

## Example

Expand Down