diff --git a/src/ng/directive/select.js b/src/ng/directive/select.js index 9d7dd84a376d..f00228a91413 100644 --- a/src/ng/directive/select.js +++ b/src/ng/directive/select.js @@ -483,7 +483,7 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) { if (multiple) { return isDefined(selectedSet.remove(callExpression(compareValueFn, key, value))); } else { - return viewValue == callExpression(compareValueFn, key, value); + return viewValue === callExpression(compareValueFn, key, value); } }; } diff --git a/test/ng/directive/selectSpec.js b/test/ng/directive/selectSpec.js index 7aa91b97fcfb..412e6e4c8b69 100644 --- a/test/ng/directive/selectSpec.js +++ b/test/ng/directive/selectSpec.js @@ -1629,6 +1629,20 @@ describe('select', function() { expect(element.val()).toEqual('?'); expect(element.find('option').eq(0).attr('selected')).toEqual('selected'); }); + + + it('should select the correct option for selectAs and falsy values', function() { + scope.values = [{value: 0, label: 'zero'}, {value: 1, label: 'one'}]; + scope.selected = ''; + createSelect({ + 'ng-model': 'selected', + 'ng-options': 'option.value as option.label for option in values' + }); + + var option = element.find('option').eq(0); + expect(option.val()).toBe('?'); + expect(option.text()).toBe(''); + }); });