Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display validity when model is $touched, not when $dirty #12

Open
wolfika opened this issue Nov 9, 2017 · 2 comments
Open

Display validity when model is $touched, not when $dirty #12

wolfika opened this issue Nov 9, 2017 · 2 comments

Comments

@wolfika
Copy link

wolfika commented Nov 9, 2017

Consider this element:

<input type="text" name="subject" id="subject" ng-model="message.subject" required />

Current behaviour: clicking the field and then leaving it does not trigger validation because the model is $pristine.

Expected behaviour: regardless of being $pristine, the validation display should trigger when the model becomes $touched. I think it would be more logical to display validity status after entering and leaving the input.

See how Angular Material, a popular Angular.js library implements the described behaviour. (scroll down to Errors section to see a required field, and click into it, then out of it.) https://material.angularjs.org/HEAD/demo/input

What are your thoughts on this one?

@8bitDesigner
Copy link
Owner

I love it; that's a great idea! Fancy whipping up a PR for me?

@wolfika
Copy link
Author

wolfika commented Nov 9, 2017

Sure! I'll send a PR as soon as I have the time. 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants