diff options
| author | Sudhir Jonathan | 2012-10-21 12:57:27 +0530 |
|---|---|---|
| committer | Igor Minar | 2012-10-31 15:03:13 -0700 |
| commit | b3cae4f457f1688346bbd0b08cccc9c504f83406 (patch) | |
| tree | 0d7204f92d25150e677b4957c5168cc96855b8e0 /src/ng/directive/select.js | |
| parent | 7b52a976e1fdcccf05a90b6fdc66f41a65c78f3d (diff) | |
| download | angular.js-b3cae4f457f1688346bbd0b08cccc9c504f83406.tar.bz2 | |
fix(select): select option with a label of 0 is not shown
Bug caused by the use of the `||` operator to replace all non-truthy
values with an empty string. Changed to replace only `undefined` values.
Closes #1401
Diffstat (limited to 'src/ng/directive/select.js')
| -rw-r--r-- | src/ng/directive/select.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ng/directive/select.js b/src/ng/directive/select.js index 0c94ddcb..e6e0ced7 100644 --- a/src/ng/directive/select.js +++ b/src/ng/directive/select.js @@ -386,7 +386,8 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) { selected, selectedSet = false, // nothing is selected yet lastElement, - element; + element, + label; if (multiple) { selectedSet = new HashMap(modelValue); @@ -410,9 +411,11 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) { selected = modelValue === valueFn(scope, locals); selectedSet = selectedSet || selected; // see if at least one item is selected } + label = displayFn(scope, locals); // what will be seen by the user + label = label === undefined ? '' : label; // doing displayFn(scope, locals) || '' overwrites zero values optionGroup.push({ id: keyName ? keys[index] : index, // either the index into array or key from object - label: displayFn(scope, locals) || '', // what will be seen by the user + label: label, selected: selected // determine if we should be selected }); } |
