Actual Behavior:
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
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.8
Angular Material Version:1.1.1
Additional Information:
Browser Type: * Chrome
Browser Version: *
OS: * Windows
Stack Traces:
Shortcut to create a new CodePen Demo.
Note: * indicates required information. Without this information, your issue may be auto-closed.
Do not modify the titles or questions. Simply add your responses to the ends of the questions.
Add more lines if needed.