Open mtraynham opened 7 years ago
Inside a <form> element, the form's $dirty flag is being set on initialization when using <sm-date-time-picker>.
<form>
<sm-date-time-picker>
I believe it may be related to how you are using the ngModelCtrl on a few of these lines... https://github.com/mominsamir/smDateTimeRangePicker/blob/c81ba03b0b216d264f13a81d294a48ff44c5b1f7/src/picker.js#L1000-L1033
This line in particular, will cause an update the to the modelValue, but I think you really want to move most of this code up into the $formatter, and have the $formatter return the viewValue.
modelValue
$formatter
viewValue
This is a good diagram of how to interact with the ngModelCtrl. https://www.bennadel.com/resources/uploads/2015/ng-model-parsing-formatting-angularjs.png
Inside a
<form>
element, the form's $dirty flag is being set on initialization when using<sm-date-time-picker>
.I believe it may be related to how you are using the ngModelCtrl on a few of these lines... https://github.com/mominsamir/smDateTimeRangePicker/blob/c81ba03b0b216d264f13a81d294a48ff44c5b1f7/src/picker.js#L1000-L1033
This line in particular, will cause an update the to the
modelValue
, but I think you really want to move most of this code up into the$formatter
, and have the$formatter
return theviewValue
.This is a good diagram of how to interact with the ngModelCtrl. https://www.bennadel.com/resources/uploads/2015/ng-model-parsing-formatting-angularjs.png