I have a jqx-date-time-input inside a form element connected to a model object with ng-model. As soon as the page loads up, the form’s pristine property changes to “false”, without having changed the date. Upon further debugging, I noticed that as soon the controller loads up, jqx-date-time-input is initialized with the “current date”, but is immediately “changed” to the value binded by ng-model. This apparently causes the change in the form’s $pristine property.
Here is a simple example that provokes the situation:
HTML:
<div ng-controller="dateCtrl">
<h1>{{frm.$pristine}}</h1>
<form name="frm">
<label for="datetest">Date:</label>
<jqx-date-time-input id="datetest" jqx-ng-model ng-model="date" ></jqx-date-time-input>
</form>
</div>
JS
kdpoc.controller('dateCtrl', ['$scope', '$timeout',
function($scope, $timeout) {
$scope.date = new Date(2014, 10, 10);
}
]);