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

Commit

Permalink
fix(select): fix touched status flicker
Browse files Browse the repository at this point in the history
closes #5879
  • Loading branch information
rschmukler committed Nov 29, 2015
1 parent 3d65dea commit c633ad8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/components/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ function SelectDirective($mdSelect, $mdUtil, $mdTheming, $mdAria, $compile, $par
return function postLink(scope, element, attr, ctrls) {
var isDisabled;

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

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

function openSelect() {
selectScope.isOpen = true;
if (firstOpen) {
element.on('blur', setUntouched);
firstOpen = false;
}

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

function setUntouched() {
ngModelCtrl.$setUntouched();
element.off('blur', setUntouched);
}
}
};
Expand Down

0 comments on commit c633ad8

Please sign in to comment.