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

Commit 54a1d0d

Browse files
crisbetokara
authored andcommitted
fix(select): unable to switch between falsy options (#9945)
Fixes #9533.
1 parent b38d928 commit 54a1d0d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/components/select/select.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ function SelectMenuDirective($parse, $mdUtil, $mdConstant, $mdTheming) {
889889
var newVal = self.isMultiple ? values : values[0];
890890
var prevVal = self.ngModel.$modelValue;
891891

892-
if (usingTrackBy ? !angular.equals(prevVal, newVal) : prevVal != newVal) {
892+
if (usingTrackBy ? !angular.equals(prevVal, newVal) : prevVal !== newVal) {
893893
self.ngModel.$setViewValue(newVal);
894894
self.ngModel.$render();
895895
}

src/components/select/select.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,15 @@ describe('<md-select>', function() {
798798
expect($rootScope.model).toBe(4);
799799
});
800800

801+
it('should allow switching between falsy options', inject(function($rootScope) {
802+
$rootScope.model = false;
803+
var el = setupSelect('ng-model="$root.model"', [false, 0]);
804+
805+
openSelect(el);
806+
clickOption(el, 1);
807+
808+
expect($rootScope.model).toBe(0);
809+
}));
801810
});
802811
});
803812

0 commit comments

Comments
 (0)