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
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Pristine controls stay pristine after form submit #7850
In some of 1.3.0 betas it worked in such way (beta 8, I think). And it was useful for me. But You are right, maybe it is not what we expect by default.
It can be useful in case like this. For example, there is a login form. There are also two required inputs on this form: username and password. I put some css on inputs, when they are .ng-invalid-required and .ng-dirty (to show user, that they are required). If we just press "submit" on form, nothing will happen. There must be handler to show user, that username and password are required.
But if controls will become dirty on submit, there will be no need in additional handler.
Activity
rodyhaddad commentedon Jun 29, 2014
At first glance, we don't want to set a field as dirty if we're not actually changing the value, so this works as expected.
Mind posting a plunkr showcasing when this is an issue?
dmitrymushenko commentedon Jul 1, 2014
In some of 1.3.0 betas it worked in such way (beta 8, I think). And it was useful for me. But You are right, maybe it is not what we expect by default.
It can be useful in case like this. For example, there is a login form. There are also two required inputs on this form: username and password. I put some css on inputs, when they are .ng-invalid-required and .ng-dirty (to show user, that they are required). If we just press "submit" on form, nothing will happen. There must be handler to show user, that username and password are required.
But if controls will become dirty on submit, there will be no need in additional handler.
http://plnkr.co/edit/WLJDE8XEdYHtBSUFrQXe?p=preview
rodyhaddad commentedon Jul 10, 2014
#8056 should introduce a
.ng-submittedclass that you'll be able to use for your scenario.Thanks for making us aware of it! :-)
rodyhaddad commentedon Jul 11, 2014
Let's keep this open till #8056 gets merged
You never know what will end up happening to it :-)
dmitrymushenko commentedon Jul 11, 2014
Ok :)
Thanks for attention!
rodyhaddad commentedon Aug 1, 2014
.ng-submittedis now a thing, woo!