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

Commit c633ad8

Browse files
committed
fix(select): fix touched status flicker
closes #5879
1 parent 3d65dea commit c633ad8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/components/select/select.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@ function SelectDirective($mdSelect, $mdUtil, $mdTheming, $mdAria, $compile, $par
185185
return function postLink(scope, element, attr, ctrls) {
186186
var isDisabled;
187187

188-
var firstOpen = true;
188+
// Remove event ngModel's blur listener for touched and untouched
189+
// we will do it ourself.
190+
$mdUtil.nextTick(function() {
191+
element.off('blur');
192+
});
189193

190194
var containerCtrl = ctrls[0];
191195
var mdSelectCtrl = ctrls[1];
@@ -432,10 +436,6 @@ function SelectDirective($mdSelect, $mdUtil, $mdTheming, $mdAria, $compile, $par
432436

433437
function openSelect() {
434438
selectScope.isOpen = true;
435-
if (firstOpen) {
436-
element.on('blur', setUntouched);
437-
firstOpen = false;
438-
}
439439

440440
$mdSelect.show({
441441
scope: selectScope,
@@ -452,7 +452,6 @@ function SelectDirective($mdSelect, $mdUtil, $mdTheming, $mdAria, $compile, $par
452452

453453
function setUntouched() {
454454
ngModelCtrl.$setUntouched();
455-
element.off('blur', setUntouched);
456455
}
457456
}
458457
};

0 commit comments

Comments
 (0)