aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ng/directive/select.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ng/directive/select.js b/src/ng/directive/select.js
index 36620dca..71742191 100644
--- a/src/ng/directive/select.js
+++ b/src/ng/directive/select.js
@@ -384,6 +384,7 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
modelValue = ctrl.$modelValue,
values = valuesFn(scope) || [],
keys = keyName ? sortedKeys(values) : values,
+ key,
groupLength, length,
groupIndex, index,
locals = {},
@@ -399,8 +400,17 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
// We now build up the list of options we need (we merge later)
for (index = 0; length = keys.length, index < length; index++) {
- locals[valueName] = values[keyName ? locals[keyName]=keys[index]:index];
- optionGroupName = groupByFn(scope, locals) || '';
+
+ key = index;
+ if (keyName) {
+ key = keys[index];
+ if ( key.charAt(0) === '$' ) continue;
+ locals[keyName] = key;
+ }
+
+ locals[valueName] = values[key];
+
+ optionGroupName = groupByFn(scope, locals) || '';
if (!(optionGroup = optionGroups[optionGroupName])) {
optionGroup = optionGroups[optionGroupName] = [];
optionGroupNames.push(optionGroupName);