diff --git a/src/ng/directive/select.js b/src/ng/directive/select.js index 6533fe8906c5..4833331fb49d 100644 --- a/src/ng/directive/select.js +++ b/src/ng/directive/select.js @@ -83,8 +83,11 @@ var SelectController = // Tell the select control that an option, with the given value, has been added - self.addOption = function(value) { + self.addOption = function(value, element) { assertNotHasOwnProperty(value, '"option value"'); + if (value === '') { + self.emptyOption = element; + } var count = optionsMap.get(value) || 0; optionsMap.put(value, count + 1); }; diff --git a/test/ng/directive/selectSpec.js b/test/ng/directive/selectSpec.js index 5be377aa54ee..2e6c78d8dc40 100644 --- a/test/ng/directive/selectSpec.js +++ b/test/ng/directive/selectSpec.js @@ -200,6 +200,42 @@ describe('select', function() { describe('empty option', function() { + it('should allow dynamic empty option', function() { + scope.dynamicOptions = []; + + compile('' + '' +