当我单击datetimepicker
按钮时,它会清除日期。
'use strict';
app.directive('defaultDate', function () {
return {
restrict: 'E',
templateUrl: 'app/directives/default-date.html',
scope: {
onChange: '&',
obj: '='
},
controller: function ($scope) {
$scope.alterou = function () {
$scope.onChange()
}
$scope.openCalendar = function (e) {
e.preventDefault()
e.stopPropagation()
$scope.obj = { isOpen: true };
};
}
}
})
<p class="input-group">
<input type="text" class="form-control" ng-change='alterou()' datetime-picker="dd/MM/yyyy HH:mm" ng-model="obj.date" is-open="obj.isOpen" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="openCalendar($event, prop)"><i class="fa fa-calendar"></i></button>
</span>
</p>
我希望日历不会通过打开它来清除日期。