Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 9494295

Browse files
committed
fix(ngOptions): add ngEmptyValue attribute to ngOptions
allow an optional ng-empty-value attribute on select elements using ng-options. any option whose value is an empty string will be replaced with the given empty-value. Reference: #13334
1 parent e4bb838 commit 9494295

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/ng/directive/ngOptions.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,8 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
489489

490490
selectCtrl.readValue = function readNgOptionsValue() {
491491

492+
if (selectElement.val() == '') return $parse(attr.ngEmptyValue)(scope);
493+
492494
var selectedOption = options.selectValueMap[selectElement.val()];
493495

494496
if (selectedOption && !selectedOption.disabled) {

0 commit comments

Comments
 (0)