Skip to content

Commit

Permalink
better fix for for angular/angular.js#1553
Browse files Browse the repository at this point in the history
  • Loading branch information
_pants committed Nov 29, 2012
1 parent 312b11b commit 7d6d62d
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions app/lib/angular/angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -14084,7 +14084,7 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
var lastView;
ctrl.$render = function() {
var items = new HashMap(ctrl.$viewValue);
forEach(selectElement.children(), function(option) {
forEach(selectElement.find('option'), function(option) {
option.selected = isDefined(items.get(option.value));
});
};
Expand All @@ -14101,16 +14101,10 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
selectElement.bind('change', function() {
scope.$apply(function() {
var array = [];
function addIfSelected(option) {
forEach(selectElement.find('option'), function(option) {
if (option.selected) {
array.push(option.value);
}
}
forEach(selectElement.children(), function(child) {
if (child.tagName == 'OPTION')
addIfSelected(child);
else if (child.tagName == 'OPTGROUP')
forEach(child.getElementsByTagName('option'), addIfSelected);
});
ctrl.$setViewValue(array);
});
Expand Down

0 comments on commit 7d6d62d

Please sign in to comment.