1
1
app . controller ( 'homeCtr' , function ( $scope , $mdSidenav , readJsonData , $state , $mdDialog , $rootScope ) {
2
2
3
+
3
4
$scope . toggleLeft = buildToggler ( 'left' ) ;
4
5
function buildToggler ( id ) {
5
6
return function ( ) {
6
- //$mdSidenav(id).toggle();
7
- //$scope.t = 0;
8
- //console.log($mdSidenav(id));
9
- //console.log(document.getElementById("hideSideBar"));
10
-
11
7
if ( id === 'left' ) {
12
8
$mdSidenav ( id ) . toggle ( ) ;
13
9
var isOpen = $mdSidenav ( id ) . isOpen ( ) ;
14
10
if ( isOpen )
15
11
{
16
12
document . getElementById ( "dashboardid" ) . style . marginLeft = "25%" ;
17
13
document . getElementById ( "hideSideBar" ) . style . width = "25%" ;
18
-
19
14
}
20
15
else {
21
16
document . getElementById ( "dashboardid" ) . style . marginLeft = "0%" ;
22
- //document.getElementById("hideSideBar").style.width = "0%";
23
- //$scope.t=0;
24
17
}
25
-
26
18
}
27
19
}
28
20
}
@@ -44,40 +36,25 @@ app.controller('homeCtr', function($scope, $mdSidenav, readJsonData, $state, $md
44
36
$scope . uniqueStorage = [ ] ;
45
37
$scope . uniqueOS = [ ] ;
46
38
$scope . uniqueCamera = [ ] ;
39
+ $scope . favourite = [ ] ;
47
40
48
41
$scope . selectingValues = function ( id , value ) {
49
42
switch ( value ) {
50
43
case 1 :
51
- printManufacturer ( id ) ;
44
+ adding ( $scope . uniqueManufacturer , id ) ;
52
45
break ;
53
46
case 2 :
54
- printStorage ( id ) ;
47
+ adding ( $scope . uniqueStorage , id ) ;
55
48
break ;
56
49
case 3 :
57
- printOS ( id ) ;
50
+ adding ( $scope . uniqueOS , id ) ;
58
51
break ;
59
52
case 4 :
60
- printCamera ( id ) ;
53
+ adding ( $scope . uniqueCamera , id ) ;
61
54
break ;
62
55
}
63
56
}
64
57
65
- function printManufacturer ( id ) {
66
- adding ( $scope . uniqueManufacturer , id ) ;
67
- }
68
-
69
- function printStorage ( id ) {
70
- adding ( $scope . uniqueStorage , id ) ;
71
- }
72
-
73
- function printOS ( id ) {
74
- adding ( $scope . uniqueOS , id ) ;
75
- }
76
-
77
- function printCamera ( id ) {
78
- adding ( $scope . uniqueCamera , id ) ;
79
- }
80
-
81
58
function adding ( array , id ) {
82
59
var index ;
83
60
index = array . indexOf ( id ) ;
@@ -88,13 +65,20 @@ function adding(array,id){
88
65
array . push ( id ) ;
89
66
}
90
67
}
91
-
92
68
$state . go ( 'home.dashboard' ) ;
93
69
70
+ console . log ( $scope . quantity ) ;
71
+
94
72
$scope . showFavorite = function ( ) {
95
- console . log ( $rootScope . favouriteElements ) ;
96
- $state . go ( 'home.dashboard' ) ;
73
+ $state . go ( 'home.favourite' ) ;
74
+ //console.log($rootScope.favouriteElements );
97
75
}
76
+ //console.log(showFavorite);
77
+ $state . go ( 'home.favourite' ) ;
78
+
79
+ $scope . states = [ 1 , 2 , 3 , 4 , 5 ] ;
80
+
81
+
98
82
99
83
// $scope.toggleLeft = buildToggler('hideSideBar');
100
84
// function buildToggler(id) {
@@ -112,3 +96,5 @@ $scope.showFavorite = function(){
112
96
// }
113
97
114
98
} ) ;
99
+
100
+ $state . go ( 'home.favourite' ) ;
0 commit comments