Skip to content

Commit 3e9681c

Browse files
author
Saulius Cepauskas
committed
Revalidate model after successful custom validation event broadcasted
1 parent e35cdde commit 3e9681c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/directives/field.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ angular.module('schemaForm').directive('sfField',
188188
scope.ngModel.$setValidity(error, validity === true);
189189

190190
if (validity === true) {
191+
// Re-trigger model validator, that model itself would be re-validated
192+
scope.ngModel.$validate();
193+
191194
// Setting or removing a validity can change the field to believe its valid
192195
// but its not. So lets trigger its validation as well.
193196
scope.$broadcast('schemaFormValidate');

src/services/decorators.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ angular.module('schemaForm').provider('schemaFormDecorators',
256256
scope.ngModel.$setValidity(error, validity === true);
257257

258258
if (validity === true) {
259+
// Re-trigger model validator, that model itself would be re-validated
260+
scope.ngModel.$validate();
261+
259262
// Setting or removing a validity can change the field to believe its valid
260263
// but its not. So lets trigger its validation as well.
261264
scope.$broadcast('schemaFormValidate');

0 commit comments

Comments
 (0)