Skip to content

Commit 331d2eb

Browse files
committed
validation-reset and has-error input #135
1 parent eeac2f0 commit 331d2eb

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

dist/angular-validation.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -524,14 +524,17 @@
524524
*/
525525
watch();
526526

527-
ctrl.$setViewValue('');
528-
ctrl.$setPristine();
529-
ctrl.$setValidity(ctrl.$name, undefined);
530-
ctrl.$render();
531-
if (scope.messageId)
532-
angular.element(document.querySelector('#' + scope.messageId)).html('');
533-
else
534-
element.next().html('');
527+
$timeout(function() {
528+
ctrl.$setViewValue('');
529+
ctrl.$setPristine();
530+
ctrl.$setValidity(ctrl.$name, undefined);
531+
ctrl.$render();
532+
if (scope.messageId)
533+
angular.element(document.querySelector('#' + scope.messageId)).html('');
534+
else
535+
element.next().html('');
536+
});
537+
535538
});
536539

537540
/**

dist/angular-validation.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/directive.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,17 @@
232232
*/
233233
watch();
234234

235-
ctrl.$setViewValue('');
236-
ctrl.$setPristine();
237-
ctrl.$setValidity(ctrl.$name, undefined);
238-
ctrl.$render();
239-
if (scope.messageId)
240-
angular.element(document.querySelector('#' + scope.messageId)).html('');
241-
else
242-
element.next().html('');
235+
$timeout(function() {
236+
ctrl.$setViewValue('');
237+
ctrl.$setPristine();
238+
ctrl.$setValidity(ctrl.$name, undefined);
239+
ctrl.$render();
240+
if (scope.messageId)
241+
angular.element(document.querySelector('#' + scope.messageId)).html('');
242+
else
243+
element.next().html('');
244+
});
245+
243246
});
244247

245248
/**

0 commit comments

Comments
 (0)