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.
Formatters for built-in validators should not return undefined
for invalid values. #3594
Closed
Description
The $formatter
function for all the built-in validators (email
, minLength
, etc) returns undefined
if the model value is invalid. As a result:
- the model remains in an invalid state
- the corresponding ngForm and ngModel controllers have
$invalid === true
- a validation error message is displayed to the user (depending on the application)
- the form field is totally empty, so the user is left scratching their head as to the cause of the problem 😕
The validators should return the invalid value "as-is" and allow the user to see and correct it. I am happy to work up a patch if the Angular team agrees with this suggested behavior.
Demo page here: http://plnkr.co/EneUPt
Metadata
Metadata
Assignees
Labels
No labels