This repository was archived by the owner on Sep 5, 2024. It is now read-only.
datepicker: does not reset $modelValue to null when invalid - this means ng-change doesn't fire either #10231
Labels
resolution: too risky
There is too much risk or disruption with this proposal for our limited resources.
Actual Behavior:
What is the issue? *
the datepicker does not reset the $modelValue to null when the input is invalid. I think this is because it uses $setValidity instead of registering validators. Importantly this is opposite to how angular normally behaves.
As it doesn't reset the model value then ng-change events don't fire, normally they do fire when you move form a valid to an invalid modelValue.
What is the expected behavior?
The $modelValue should be set to null
CodePen (or steps to reproduce the issue): *
CodePen Demo which shows your issue:
http://codepen.io/anon/pen/OWVbNP
Details:
enter a valid date e.g. 1/1/1 - the model value updates accordingly
change date to invalid e.g. 2001/20001/20001 - the model value stays the same as it was before
compare this to the input box
enter a valid number e.g. 1 - the model value is 1
change to an invalid number e.g. -1 - the model value is reset to null
Angular Versions: *
Angular Version:
1.5.8Angular Material Version:
1.1.1Additional Information:
Browser Type: *
ChromeBrowser Version: *
OS: *
WindowsStack Traces:
Shortcut to create a new CodePen Demo.
Note:
*
indicates required information. Without this information, your issue may be auto-closed.The text was updated successfully, but these errors were encountered: