Skip to content

Commit

Permalink
feat(ValidationController): add revalidateErrors method
Browse files Browse the repository at this point in the history
fixes #349
  • Loading branch information
jdanyow committed Mar 25, 2017
1 parent 6789112 commit 47026ec
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/validation-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class ValidationController {
} else {
resolvedPropertyName = this.propertyParser.parse(propertyName);
}
const result = new ValidateResult({}, object, resolvedPropertyName, false, message);
const result = new ValidateResult({ __manuallyAdded__: true }, object, resolvedPropertyName, false, message);
this.processResultDelta('validate', [], [result]);
return result;
}
Expand Down Expand Up @@ -392,6 +392,19 @@ export class ValidationController {
binding.bind(source);
}
}

/**
* Revalidates the controller's current set of errors.
*/
public revalidateErrors() {
for (const { object, propertyName, rule } of this.errors) {
if (rule.__manuallyAdded__) {
continue;
}
const rules = [rule];
this.validate({ object, propertyName, rules });
}
}
}

/**
Expand Down

0 comments on commit 47026ec

Please sign in to comment.