-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindow.js
More file actions
30 lines (28 loc) · 765 Bytes
/
Copy pathwindow.js
File metadata and controls
30 lines (28 loc) · 765 Bytes
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
function WindowController($scope) {
const ctrl = this;
ctrl.isOpen = false;
ctrl.$onInit = function() {
// onInit open the window if it was already opened in a previous session
ctrl.isOpen = ctrl.index > 0 && ctrl.calendarCtrl.lastOpenedWindow >= ctrl.index;
}
ctrl.isOpenable = function() {
// logic to force the windows opening in the correct order
return ctrl.index === (ctrl.calendarCtrl.lastOpenedWindow + 1);
}
ctrl.open = function() {
ctrl.isOpen = true;
ctrl.onOpen({windowIdx: ctrl.index});
}
}
angular.module('calendarApp')
.component('window', {
templateUrl: "window.html",
require: {
calendarCtrl: '^calendar',
},
bindings: {
index: '<',
onOpen: '&',
},
controller: WindowController,
});