aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/directive/select.js
diff options
context:
space:
mode:
authorSudhir Jonathan2012-10-21 12:57:27 +0530
committerIgor Minar2012-10-31 15:03:48 -0700
commitd981c2a3ecfaf572a836c7533ee3a9553aae327d (patch)
tree6b795cc0ce3905866a6c365404bb73874637dacd /src/ng/directive/select.js
parent537e20065a7f4aa0346713a186e25cc819125fae (diff)
downloadangular.js-d981c2a3ecfaf572a836c7533ee3a9553aae327d.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.js7
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
});
}