-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdate-time-picker.js
62 lines (61 loc) · 1.94 KB
/
date-time-picker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
'use strict';
angular.module('azirkoDatetimepicker', [])
.directive('azirkoDateTimePicker', ['$timeout',
function($timeout) {
return {
restrict: 'A',
require: "?ngModel",
scope: {
pickDate: '@azirkoPickDate',
pickTime: '@azirkoPickTime',
useMinutes: '@azirkoUseMinutes',
useSeconds: '@azirkoUseSeconds',
useCurrent: '@azirkoUseCurrent',
minuteStepping: '@azirkoMinuteStepping',
minDate: '@azirkoMinDate',
maxDate: '@azirkoMaxDate',
showToday: '@azirkoShowToday',
collapse: '@azirkoCollapse',
language: '@azirkoLanguage',
defaultDate: '@azirkoDefaultDate',
disabledDates: '@azirkoDisabledDates',
enabledDates: '@azirkoEnabledDates',
icons: '@azirkoIcons',
useStrict: '@azirkoUseStrict',
direction: '@azirkoDirection',
sideBySide: '@azirkoSideBySide',
daysOfWeekDisabled: '@azirkoDaysOfWeekDisabled',
format: '@azirkoFormat'
},
link: function postLink(scope, element, attrs, ngModel) {
//timeout to ensure DOM is ready
$timeout(function() {
element.datetimepicker({
pickDate: scope.pickDate,
pickTime: scope.pickTime,
useMinutes: scope.useMinutes,
useSeconds: scope.useSeconds,
useCurrent: scope.useCurrent,
minuteStepping: scope.minuteStepping,
minDate: scope.minDate,
maxDate: scope.maxDate,
showToday: scope.showToday,
collapse: scope.collapse,
language: scope.language,
defaultDate: scope.defaultDate,
disabledDates: scope.disabledDates,
enabledDates: scope.enabledDates,
icons: scope.icons,
useStrict: scope.useStrict,
direction: scope.direction,
sideBySide: scope.sideBySide,
daysOfWeekDisabled: scope.daysOfWeekDisabled,
format: scope.format
});
// defaultDate is filled in the UI, but not binded to model
ngModel.$setViewValue(element.context.value);
});
}
};
}
]);