Removed close of date/time picker on date selection when set up with time picker; close picker on click on document

This commit is contained in:
AndyButland
2014-10-02 22:02:41 +02:00
parent 2c871e635f
commit d9074da3fd

View File

@@ -8,12 +8,21 @@ function dateTimePickerController($scope, notificationsService, assetsService, a
pickDate: true,
pickTime: true,
pick12HourFormat: false,
autoclose: true,
format: "yyyy-MM-dd hh:mm:ss"
};
//map the user config
$scope.model.config = angular.extend(config, $scope.model.config);
//hide picker if clicking on the document
$scope.hidePicker = function () {
$element.find("div:first").datetimepicker("hide");
};
$(document).click(function (event) {
$scope.hidePicker();
});
//handles the date changing via the api
function applyDate(e) {
angularHelper.safeApply($scope, function() {
@@ -26,8 +35,10 @@ function dateTimePickerController($scope, notificationsService, assetsService, a
$scope.model.value = e.localDate.toIsoDateString();
}
}
$element.find("div:first").datetimepicker("hide", 0);
if (!$scope.model.config.pickTime) {
$element.find("div:first").datetimepicker("hide", 0);
}
});
}