-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overriding Angular's email validator #5
Comments
Angular directive selector: selector: '[email][formControlName],[email][formControl],[email][ngModel]' Custom ng4-validators directive selector: selector: '[email][formControlName],[email][formControl],[email][ngModel]', So it both has the same selector, I don't check if the custom validator override angular validator since angular 5 release. I'll check this behavior, but I guess it's better to rename the custom directive selector to avoid issue. |
I would think so, yes, it's probably better to rename. But, apart from that, I'm a little bit confused as to how this override works, and whether it allows the previous validator run in parallel, or not. |
I think there's no override but just javascript runs both and the result is given from the last executed validator. To override default validator, I guess the custom has to implement an interface like EmailValidatorInterface but without I don't guess that is possible. |
Yeah, the "last executed" part interests me. What is the order? Is it always Angular first, then whatever's declared later? Just curious. Sorry, this probably isn't a bug request anymore. Just worth changing that email validator to avoid confusion. |
I'am unable to publish a new version for now, see angular/cli#9549. |
Released with 5.0.1 |
It seems that newer versions of Angular also have email validator. This library also offers email validator that seems to be more tight and restrictive (which is good). I wonder how it works, though, as the selector seems to be exactly the same. Does Angular run both validators under the same name, or is it overridden somehow (because declared later?)
The text was updated successfully, but these errors were encountered: