-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Description
I'm trying to use an async validator combined with your module, my api return a 200 response if email is unique and a 400 response if it's already in use.
Have you tried using async validators?
I think your module needs some way to notice if validity has changed after an async validator has been deferred.
Or do you have an working example.
The field am testing with looks like this:
<div class="form-group">
<label for="email">E-mail</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-envelope"></i></div>
<input ng-model="admin.email" id="email" name="email" class="form-control" type="email" required is-unique-admin-email ng-model-options="{debounce: 250}" />
</div>
</div>
ctrl.$asyncValidators.uniqueAdminEmail = function(modelValue, viewValue)
{
return $http({
url: "/validate/unique-admin-email?email=" + value,
method: "GET",
})
.then(function()
{
return $q.resolve();
}, function()
{
return $q.reject();
});
};