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

Commit

Permalink
fix(input): input validation and visual error indicators fixed
Browse files Browse the repository at this point in the history
Closes #1606.
  • Loading branch information
ThomasBurleson committed Mar 12, 2015
1 parent 81bcf7f commit c818da7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/input/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,8 @@ function inputTextareaDirective($mdUtil, $window) {
setupTextarea();
}

var touched = false;
var isErrorGetter = containerCtrl.isErrorGetter || function() {
return ngModelCtrl.$invalid && (touched || ngModelCtrl.$touched);
return ngModelCtrl.$invalid && ngModelCtrl.$touched;
};
scope.$watch(isErrorGetter, containerCtrl.setInvalid);

Expand All @@ -184,9 +183,7 @@ function inputTextareaDirective($mdUtil, $window) {
if (!isReadonly) {
element
.on('focus', function(ev) {
touched = true;
containerCtrl.setFocused(true);
scope.$evalAsync();
})
.on('blur', function(ev) {
containerCtrl.setFocused(false);
Expand All @@ -195,6 +192,9 @@ function inputTextareaDirective($mdUtil, $window) {

}

//ngModelCtrl.$setTouched();
//if( ngModelCtrl.$invalid ) containerCtrl.setInvalid();

scope.$on('$destroy', function() {
containerCtrl.setFocused(false);
containerCtrl.setHasValue(false);
Expand Down

0 comments on commit c818da7

Please sign in to comment.