-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdemo.js
99 lines (72 loc) · 2.46 KB
/
demo.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
(function () {
'use strict';
angular
.module('demoApp', ['ng-duallist'])
.controller('demoController', demoController);
demoController.$inject = ['$rootScope', '$filter'];
/* @ngInject */
function demoController($rootScope, $filter) {
var vm = this;
vm.property = 'demoController';
activate();
////////////////
function activate() {
vm.leftValue = [];
var leftcounter = 0;
vm.rightValue = [];
var rightcounter = 0;
vm.addValue = [];
vm.removeValue = [];
function loadMoreLeft() {
for (var i = 0; i < 15; i++) {
vm.leftValue.push({
'name': 'left' + leftcounter
});
leftcounter += 10;
}
}
function loadMoreRight() {
for (var i = 0; i < 15; i++) {
vm.rightValue.push({
'name': 'right' + rightcounter
});
rightcounter += 10;
}
}
vm.options = {
leftContainerScrollEnd: function () {
loadMoreLeft()
},
rightContainerScrollEnd: function () {
loadMoreRight();
},
leftContainerSearch: function (text) {
console.log(text)
vm.leftValue = $filter('filter')(leftValue, {
'name': text
})
},
rightContainerSearch: function (text) {
vm.rightValue = $filter('filter')(rightValue, {
'name': text
})
},
leftContainerLabel: 'Available Lists',
rightContainerLabel: 'Selected Lists',
onMoveRight: function () {
console.log('right');
console.log(vm.addValue);
},
onMoveLeft: function () {
console.log('left');
console.log(vm.removeValue);
}
};
console.log(vm.options)
loadMoreLeft();
loadMoreRight();
var leftValue = angular.copy(vm.leftValue)
var rightValue = angular.copy(vm.rightValue)
}
}
})();