-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.js
132 lines (123 loc) · 3.55 KB
/
list.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
angular.module('test')
.controller('list',function($scope,$rootScope,$location,$mdToast, $mdBottomSheet,testing, $timeout, $mdSidenav, $log){
$scope.logout=function(){
localStorage.removeItem('user');
localStorage.removeItem('data');
$rootScope.loggedIn=false;
$location.path('/login');
};
$scope.data=[];
$scope.user=localStorage.getItem('user');
$scope.onClick=function(){
$scope.config={"id":"ID",
"newThang":"Second Column"
};
setTimeout(function(){
$scope.data=[{
"id":1,
"message":"Some Random text message with id 1"
},{
"id":2,
"message":"Some Random text message with id 2"
},{
"id":3,
"message":"Some Random text message with id 3"
},{
"id":4,
"message":"Some Random text message with id 4"
},{
"id":5,
"message":"Some Random text message with id 5"
},{
"id":6,
"message":"Some Random text message with id 6"
},{
"id":7,
"message":"Some Random text messagewith id 7"
},{
"id":8,
"message":"Some Random text messagewith id 8"
},{
"id":9,
"message":"Some Random text message with id 9"
},{
"id":10,
"newThang":"newOne",
"message":"Some Random text message with id 10"
}]
},2000)
}
$scope.goto=function(e){
console.log("jjgjgj")
$location.path('/records/'+e)
};
//testing.getData(localStorage.getItem('user'))
$scope.$watch(function(){
return localStorage.getItem('data');
},function(n,o){
// $scope.data=angular.fromJson(localStorage.getItem('data'))
});
$scope.toggleLeft = buildDelayedToggler('left');
$scope.toggleRight = buildToggler('right');
$scope.isOpenRight = function(){
return $mdSidenav('right').isOpen();
};
/**
* Supplies a function that will continue to operate until the
* time is up.
*/
function debounce(func, wait, context) {
var timer;
return function debounced() {
var context = $scope,
args = Array.prototype.slice.call(arguments);
$timeout.cancel(timer);
timer = $timeout(function() {
timer = undefined;
func.apply(context, args);
}, wait || 10);
};
}
/**
* Build handler to open/close a SideNav; when animation finishes
* report completion in console
*/
function buildDelayedToggler(navID) {
return debounce(function() {
// Component lookup should always be available since we are not using `ng-if`
$mdSidenav(navID)
.toggle()
.then(function () {
$log.debug("toggle " + navID + " is done");
});
}, 200);
}
function buildToggler(navID) {
return function() {
// Component lookup should always be available since we are not using `ng-if`
$mdSidenav(navID)
.toggle()
.then(function () {
$log.debug("toggle " + navID + " is done");
});
};
}
})
.controller('LeftCtrl', function ($scope, $timeout, $mdSidenav, $log) {
$scope.close = function () {
// Component lookup should always be available since we are not using `ng-if`
$mdSidenav('left').close()
.then(function () {
$log.debug("close LEFT is done");
});
};
})
.controller('RightCtrl', function ($scope, $timeout, $mdSidenav, $log) {
$scope.close = function () {
// Component lookup should always be available since we are not using `ng-if`
$mdSidenav('right').close()
.then(function () {
$log.debug("close RIGHT is done");
});
};
});