I am using angular js with bootstrap datetimepicker and I have this input in my form:
<input class="form-control" type="text" name="dob" id="datetimepicker" ng-model="user.dob" value="{{user.dob}}" ng-blur="blur4=true" required />
<span class="error" ng-show="user.validate.step1.dob.$invalid">*</span>
and this is my jquery code for the datetimepicker:
$('#datetimepicker').datetimepicker({
format: 'MM/DD/YYYY',
viewMode: 'years'
});
however when I click on the input and select a date from the datetimepicker, it says user.validate.step1.dob.$invalid, is invalid, why is that?
I have tried the following inside my directive:
link: function (scope) {
scope.currentStepIndex = 0;
scope.steps[scope.currentStepIndex].currentStep = true;
$('#datetimepicker').datetimepicker({
format: 'MM/DD/YYYY',
viewMode: 'years',
}).on("change.dp", function (selectedDate) {
scope.$apply(function () {
ngModel.$setViewValue(dateText);
});
});
}
and it still marks my dob as not valid.