@@ -4,64 +4,76 @@ import { Component, OnInit } from '@angular/core';
4
4
import { Title } from '@angular/platform-browser' ;
5
5
import { TdLoadingService , TdDigitsPipe , CovalentNotificationsModule } from '@covalent/core' ;
6
6
import { MdSnackBar } from '@angular/material' ;
7
-
8
7
import { CartService } from '../cart.service' ;
9
8
10
9
@Component ( {
11
10
selector : 'qs-dashboard' ,
12
11
templateUrl : './dashboard.component.html' ,
13
- styleUrls : [ './dashboard.component.scss' ]
14
- // providers: [CartService],
12
+ styleUrls : [ './dashboard.component.scss' ] ,
15
13
} )
14
+
16
15
export class DashboardComponent implements OnInit {
16
+ itemArray : any [ ] = [ ] ;
17
17
imageArray : any [ ] = [ {
18
18
19
19
columnSize : '40' ,
20
20
column : [ {
21
+ name : '' ,
21
22
url : '../../assets/images/alex-lambley-205711-min.jpg' ,
22
23
isclicked : false ,
23
24
} , {
25
+ name : '' ,
24
26
url : '../../assets/images/norman-toth-177290-min.jpg' ,
25
27
isclicked : false ,
26
28
} , {
29
+ name : '' ,
27
30
url : '../../assets/images/kaci-baum-108756-min.jpg' ,
28
31
isclicked : false ,
29
32
} , {
33
+ name : '' ,
30
34
url : '../../assets/images/ariel-lustre-232891-min.jpg' ,
31
35
isclicked : false ,
32
36
} ] ,
33
37
} , {
34
38
columnSize : '25' ,
35
39
column : [ {
40
+ name : '' ,
36
41
url : '../../assets/images/pete-bellis-189599-min.jpg' ,
37
42
isclicked : false ,
38
43
} , {
44
+ name : '' ,
39
45
url : '../../assets/images/remy_loz-188297-min.jpg' ,
40
46
isclicked : false ,
41
47
} , {
48
+ name : '' ,
42
49
url : '../../assets/images/brooke-cagle-195860-min.jpg' ,
43
50
isclicked : false ,
44
51
} , {
52
+ name : '' ,
45
53
url : '../../assets/images/freestocks-org-195640-min.jpg' ,
46
54
isclicked : false ,
47
55
} ] ,
48
56
} , {
49
57
columnSize : '25' ,
50
58
column : [ {
59
+ name : '' ,
51
60
url : '../../assets/images/pete-bellis-189613-min.jpg' ,
52
61
isclicked : false ,
53
62
} , {
63
+ name : '' ,
54
64
url : '../../assets/images/pete-bellis-191833-min.jpg' ,
55
65
isclicked : false ,
56
66
} ,
57
67
] ,
58
68
} , {
59
69
columnSize : '25' ,
60
70
column : [ {
71
+ name : '' ,
61
72
url : '../../assets/images/valerie-elash-275588-min.jpg' ,
62
73
isclicked : false ,
63
74
} ,
64
75
{
76
+ name : '' ,
65
77
url : '../../assets/images/jason-blackeye-221058-min.jpg' ,
66
78
isclicked : false ,
67
79
} ] ,
@@ -76,18 +88,24 @@ export class DashboardComponent implements OnInit {
76
88
77
89
ngOnInit ( ) : void {
78
90
this . _titleService . setTitle ( 'Covalent Quickstart' ) ;
91
+ this . itemArray = this . cartService . getItems ( ) ;
79
92
}
80
93
81
94
clickedImage ( imageUrl : any ) : void {
82
95
this . router . navigate ( [ '/image-view' , { url : imageUrl } ] ) ;
83
-
84
96
}
97
+
85
98
clickedAddToCart ( imageUrl : any ) : void {
86
99
const img : string = imageUrl ;
87
100
this . cartService . clickedAddToCart ( img ) ;
88
101
}
102
+
89
103
notifications ( ) : number {
90
104
const nItems : number = this . cartService . getNitems ( ) ;
91
105
return nItems ;
92
106
}
107
+
108
+ clickedCart ( ) : void {
109
+ this . itemArray = this . cartService . getItems ( ) ;
110
+ }
93
111
}
0 commit comments