1
- app . controller ( 'homeCtr' , function ( $scope , $mdSidenav , readJsonData , $state , $mdDialog ) {
2
- $scope . consoleDisplay = function ( ) {
3
- console . log ( $scope . user ) ;
4
- console . log ( $scope . pass ) ;
5
- }
1
+ app . controller ( 'homeCtr' , function ( $scope , $mdSidenav , readJsonData , $state , $mdDialog , $rootScope ) {
2
+ // $scope.consoleDisplay = function() {
3
+ // console.log($scope.user);
4
+ // console.log($scope.pass);
5
+ // }
6
6
7
7
$scope . toggleLeft = buildToggler ( 'left' ) ;
8
-
9
8
function buildToggler ( id ) {
10
9
return function ( ) {
11
10
$mdSidenav ( id ) . toggle ( ) ;
11
+ }
12
12
}
13
- }
13
+
14
+ $scope . fileData = function ( ) {
15
+ console . log ( $scope . display ) ;
16
+ }
17
+
18
+ // $scope.toggleLeft = buildToggler('hideSideBar');
19
+ // function buildToggler(id) {
20
+ // return function(){
21
+ // var e = document.getElementById(id);
22
+ // console.log(e.style.display);
23
+ // if(e.style.display == 'none' || e.style.display == ''){
24
+ // e.classList.remove("md-closed");
25
+ // e.style.display = 'block';
26
+ // }else{
27
+ // e.classList.add("md-closed");
28
+ // e.style.display = 'none';
29
+ // }
30
+ // }
31
+ // }
32
+
14
33
// function buildToggler(componentId){
15
34
// if (!hidden) {
16
35
// jq('#hideme').addClass('hidden');
@@ -25,16 +44,103 @@ app.controller('homeCtr', function($scope, $mdSidenav, readJsonData, $state, $md
25
44
console . log ( $scope . data ) ;
26
45
} )
27
46
28
- $state . go ( 'home.dashboard' ) ;
47
+ $rootScope . uniqueManufacturer = [ ] ;
48
+ $scope . uniqueStorage = [ ] ;
49
+ var uniqueOS = [ ] ;
50
+ var uniqueCamera = [ ] ;
51
+
52
+ $scope . printManufacturer = function ( id , data ) {
53
+ var index ;
54
+ var value ;
55
+ var m = 'manufacturer' ;
56
+ for ( var i = 0 ; i < data . length ; i ++ ) {
57
+ value = data [ i ] . specs [ m ] ;
58
+
59
+ index = $scope . uniqueManufacturer . indexOf ( id ) ;
60
+ console . log ( index ) ;
61
+ if ( index > - 1 ) {
62
+ $scope . uniqueManufacturer . splice ( index , 1 ) ;
63
+ break ;
64
+ }
65
+ else {
66
+ $scope . uniqueManufacturer . push ( id ) ;
67
+ break ;
68
+ }
69
+ //console.log(value);
70
+ }
71
+ // console.log($scope.uniqueManufacturer);
72
+ }
73
+
74
+ $scope . printStorage = function ( id , data ) {
75
+ var index ;
76
+ var value ;
77
+ var m = 'storage' ;
78
+ for ( var i = 0 ; i < data . length ; i ++ ) {
79
+ value = data [ i ] . specs [ m ] ;
80
+
81
+ index = $scope . uniqueStorage . indexOf ( id ) ;
82
+ console . log ( index ) ;
83
+ if ( index > - 1 ) {
84
+ $scope . uniqueStorage . splice ( index , 1 ) ;
85
+ break ;
86
+ }
87
+ else {
88
+ $scope . uniqueStorage . push ( id ) ;
89
+ break ;
90
+ }
91
+ //console.log(value);
92
+ }
93
+ //console.log($scope.uniqueStorage);
94
+ }
29
95
96
+ $scope . printOS = function ( id , data ) {
97
+ var index ;
98
+ var value ;
99
+ var m = 'os' ;
100
+ for ( var i = 0 ; i < data . length ; i ++ ) {
101
+ value = data [ i ] . specs [ m ] ;
102
+
103
+ index = uniqueOS . indexOf ( id ) ;
104
+ console . log ( index ) ;
105
+ if ( index > - 1 ) {
106
+ uniqueOS . splice ( index , 1 ) ;
107
+ break ;
108
+ }
109
+ else {
110
+ uniqueOS . push ( id ) ;
111
+ break ;
112
+ }
113
+ console . log ( value ) ;
114
+ }
115
+ console . log ( uniqueOS ) ;
116
+ }
117
+
118
+ $scope . printCamera = function ( id , data ) {
119
+ var index ;
120
+ var value ;
121
+ var m = 'camera' ;
122
+ for ( var i = 0 ; i < data . length ; i ++ ) {
123
+ value = data [ i ] . specs [ m ] ;
124
+
125
+ index = uniqueCamera . indexOf ( id ) ;
126
+ console . log ( index ) ;
127
+ if ( index > - 1 ) {
128
+ uniqueCamera . splice ( index , 1 ) ;
129
+ break ;
130
+ }
131
+ else {
132
+ uniqueCamera . push ( id ) ;
133
+ break ;
134
+ }
135
+ console . log ( value ) ;
136
+ }
137
+ console . log ( uniqueCamera ) ;
138
+ }
139
+
140
+ // $scope.exists = function(id){
141
+ // return uniqueManufacturer.indexOf(id) > -1;
142
+ // }
143
+
144
+ $state . go ( 'home.dashboard' ) ;
30
145
31
146
} ) ;
32
- // var e = document.getElementById(id);
33
- // console.log(e.style.display);
34
- // if(e.style.display == 'none' || e.style.display == ''){
35
- // e.classList.remove("md-closed");
36
- // e.style.display = 'block';
37
- // }else{
38
- // e.classList.add("md-closed");
39
- // e.style.display = 'none';
40
- // }
0 commit comments