diff options
| author | Gowtam Lal | 2013-09-13 12:41:51 +0100 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-09-13 12:48:19 +0100 |
| commit | aa3c54c73f7470999535294899a1c33cd193f455 (patch) | |
| tree | 9a2439fb5074071e36c3a4dbf576735b3e97b02d /src/ng/directive/select.js | |
| parent | f115751d541596e78f1c2e755ea7e1ad7e1a1f8a (diff) | |
| download | angular.js-aa3c54c73f7470999535294899a1c33cd193f455.tar.bz2 | |
fix(ngOptions): ignore object properties which start with $
Diffstat (limited to 'src/ng/directive/select.js')
| -rw-r--r-- | src/ng/directive/select.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ng/directive/select.js b/src/ng/directive/select.js index a62f706c..9fd2077d 100644 --- a/src/ng/directive/select.js +++ b/src/ng/directive/select.js @@ -406,6 +406,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 = {}, @@ -429,8 +430,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); |
