This repository was archived by the owner on Aug 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
Async Validators
Jon Samwell edited this page Nov 30, 2015
·
2 revisions
See http://plnkr.co/edit/3YXEQAU051N4gFCRPi7S?p=preview
You can configure the library not to display validation until all the async validators have returned. This is the default behaviour however it can be switched off at a global or form level.
Global Level
function RunFn(validator) {
validator.defaultFormValidationOptions.waitForAsyncValidators = false;
}
RunFn.$inject = [
'validator'
];
app.run(RunFn);
Form Level
<form role="form" name="testFrm" novalidate="novalidate"
ng-submit="submit();"
wait-for-async-validators="false">
....
</form>
The bootstrap 3 modifier is configured to show a spinner while waiting for the async validators to return. If you have a custom validation element modifier class you will need to implement a method called 'waitForAsyncValidators' which takes in an angular element. See the Bootstrap 3 Element Modifier as an example: