Skip to content
This repository has been 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
niallsmart opened this issue Aug 14, 2013 · 1 comment

Comments

@niallsmart
Copy link
Contributor

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

@jbdeboer
Copy link
Contributor

jbdeboer commented Sep 1, 2013

Dupe of #2841 (lower issue numbers win)

@jbdeboer jbdeboer closed this as completed Sep 1, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants