You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm in the same situation right now: min and max price filters, both optional. But if both are specified, a validation is needed (min <= max). So, I use CompareValidator for this, but it reports an error if one of the 2 fields is empty.
I see the following options:
CompareValidator should ignore nulls. If somebody needs to ensure non-null values, they can add Validators.required. That could be the simplest solution, but, unfortunately, it's a breaking change now.
custom validator, as you suggest. A duplication of CompareValidator. Duplication is not a good practice. Obviously, that's the reason why you want to avoid it and why you created this issue.
combine CompareValidator inside Validators.composeOR with a custom AllowNullValidator which only purpose is to report VALID for null values (and thus suppress the error coming from CompareValidator). This solution is acceptable but AllowNullValidator doesn't make much sense on its own.
I need to specify start and end dates for an event with the following constraints:
Currently, using Validators.compare, I'm getting an error notification even if the end date is not specified.
Should I implement a custom validator?
The text was updated successfully, but these errors were encountered: