Closed sebastian-zarzycki-apzumi closed 6 years ago
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. I won't publish without run tests.
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?)