When I press any keyboard key, e.g. 0, and if I lose focus, it automatically gets set to control as 00:00, but it does not update the model value.
angular.module('test').directive('timePicker', [function () {
return {
restrict: 'A',
require: 'ngModel',
scope: {
model: '=ngModel'
},
link: function ($scope, element, attrs, ngModelCtrl) {
element.timepicker({'timeFormat' : 'H:i'});
////element.on('change', function () {
//// scope.$apply(function () {
//// scope.model = element.datepicker('getTime');
//// });
////});
////$scope.$watch('model', function (newValues, oldValues, scope) {
//// console.log("Nothing here");
////});
}
}
}]);
<input id="startTime" type="text" name="startTime" data-ng-model="vm.data.StartTime" time-picker />
I am not able to validate time because of model is not updated. commented code is what I have tried to update value.
Any ideas on how to fix this?