What's the reasoning behind Angular's decision to not reset an input's class from ng-dirty to ng-pristine after the user manually set a field back to its initial value?
I want to execute my save logic only if the user actually changed some of the form's data. Is there a better way than to manually hold the initial state and check for differences on submit?
The status is dirty this means the user changed the value. Angular doesn't track the original value though and therefore can't tell if the original value was restored.
If you want to know if the value changed, you have to store the value and on submit compare yourself if it has changed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With