Skip to content

Commit

Permalink
validation-reset and has-error input #135
Browse files Browse the repository at this point in the history
  • Loading branch information
hueitan committed Sep 16, 2015
1 parent eeac2f0 commit 331d2eb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
19 changes: 11 additions & 8 deletions dist/angular-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,14 +524,17 @@
*/
watch();

ctrl.$setViewValue('');
ctrl.$setPristine();
ctrl.$setValidity(ctrl.$name, undefined);
ctrl.$render();
if (scope.messageId)
angular.element(document.querySelector('#' + scope.messageId)).html('');
else
element.next().html('');
$timeout(function() {
ctrl.$setViewValue('');
ctrl.$setPristine();
ctrl.$setValidity(ctrl.$name, undefined);
ctrl.$render();
if (scope.messageId)
angular.element(document.querySelector('#' + scope.messageId)).html('');
else
element.next().html('');
});

});

/**
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-validation.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions src/directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,17 @@
*/
watch();

ctrl.$setViewValue('');
ctrl.$setPristine();
ctrl.$setValidity(ctrl.$name, undefined);
ctrl.$render();
if (scope.messageId)
angular.element(document.querySelector('#' + scope.messageId)).html('');
else
element.next().html('');
$timeout(function() {
ctrl.$setViewValue('');
ctrl.$setPristine();
ctrl.$setValidity(ctrl.$name, undefined);
ctrl.$render();
if (scope.messageId)
angular.element(document.querySelector('#' + scope.messageId)).html('');
else
element.next().html('');
});

});

/**
Expand Down

0 comments on commit 331d2eb

Please sign in to comment.