This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
ngRequired: suggest mark empty arrays as invalid #2365
Closed
Description
Current validator in the ngRequired directive looks like:
var validator = function(value) {
if (attr.required && (isEmpty(value) || value === false)) {
ctrl.$setValidity('required', false);
return;
} else {
ctrl.$setValidity('required', true);
return value;
}
};
Value checked by isEmpty
function which returns true for empty arrays.
if (attr.required && (isEmpty(value) || value === false)) {
I think that []
should be marked as invalid for this case.