From 8333082c6b2e1347405933e8898eb3f69de6fa0e Mon Sep 17 00:00:00 2001 From: Michael Kintzer Date: Sun, 9 Feb 2014 11:55:20 -0800 Subject: [PATCH] modify readme.md. Document select options hidden workaround --- readme.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index bfd9c26..8eaf0ca 100644 --- a/readme.md +++ b/readme.md @@ -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