11import { Component } from "@angular/core" ;
22
33@Component ( {
4- selector : 'pm-products' ,
5- templateUrl : './product-list.component.html'
4+ selector : 'pm-products' ,
5+ templateUrl : './product-list.component.html'
66} )
77export class ProductListComponent {
8- pageTitle : string = 'Product List' ;
9- products : any [ ] = [
10- {
11- "productId" : 1 ,
12- "productName" : "Leaf Rake" ,
13- "productCode" : "GDN-0011" ,
14- "releaseDate" : "March 19, 2016" ,
15- "description" : "Leaf rake with 48-inch wooden handle." ,
16- "price" : 19.95 ,
17- "starRating" : 3.2 ,
18- "imageUrl" : "https://openclipart.org/image/300px/svg_to_png/26215/Anonymous_Leaf_Rake.png"
19- } ,
20- {
21- "productId" : 2 ,
22- "productName" : "Garden Cart" ,
23- "productCode" : "GDN-0023" ,
24- "releaseDate" : "March 18, 2016" ,
25- "description" : "15 gallon capacity rolling garden cart" ,
26- "price" : 32.99 ,
27- "starRating" : 4.2 ,
28- "imageUrl" : "https://openclipart.org/image/300px/svg_to_png/58471/garden_cart.png"
29- } ,
30- {
31- "productId" : 5 ,
32- "productName" : "Hammer" ,
33- "productCode" : "TBX-0048" ,
34- "releaseDate" : "May 21, 2016" ,
35- "description" : "Curved claw steel hammer" ,
36- "price" : 8.9 ,
37- "starRating" : 4.8 ,
38- "imageUrl" : "https://openclipart.org/image/300px/svg_to_png/73/rejon_Hammer.png"
39- } ,
40- {
41- "productId" : 8 ,
42- "productName" : "Saw" ,
43- "productCode" : "TBX-0022" ,
44- "releaseDate" : "May 15, 2016" ,
45- "description" : "15-inch steel blade hand saw" ,
46- "price" : 11.55 ,
47- "starRating" : 3.7 ,
48- "imageUrl" : "https://openclipart.org/image/300px/svg_to_png/27070/egore911_saw.png"
49- } ,
50- {
51- "productId" : 10 ,
52- "productName" : "Video Game Controller" ,
53- "productCode" : "GMG-0042" ,
54- "releaseDate" : "October 15, 2015" ,
55- "description" : "Standard two-button video game controller" ,
56- "price" : 35.95 ,
57- "starRating" : 4.6 ,
58- "imageUrl" : "https://openclipart.org/image/300px/svg_to_png/120337/xbox-controller_01.png"
59- }
60- ] ;
8+ pageTitle : string = 'Product List' ;
9+ imageWidth : number = 50 ;
10+ imageMargin : number = 2 ;
11+ showImage : boolean = false ;
12+ listFilter : string = 'cart' ;
13+ products : any [ ] = [
14+ {
15+ "productId" : 1 ,
16+ "productName" : "Leaf Rake" ,
17+ "productCode" : "GDN-0011" ,
18+ "releaseDate" : "March 19, 2016" ,
19+ "description" : "Leaf rake with 48-inch wooden handle." ,
20+ "price" : 19.95 ,
21+ "starRating" : 3.2 ,
22+ "imageUrl" : "https://openclipart.org/image/300px/svg_to_png/26215/Anonymous_Leaf_Rake.png"
23+ } ,
24+ {
25+ "productId" : 2 ,
26+ "productName" : "Garden Cart" ,
27+ "productCode" : "GDN-0023" ,
28+ "releaseDate" : "March 18, 2016" ,
29+ "description" : "15 gallon capacity rolling garden cart" ,
30+ "price" : 32.99 ,
31+ "starRating" : 4.2 ,
32+ "imageUrl" : "https://openclipart.org/image/300px/svg_to_png/58471/garden_cart.png"
33+ } ,
34+ {
35+ "productId" : 5 ,
36+ "productName" : "Hammer" ,
37+ "productCode" : "TBX-0048" ,
38+ "releaseDate" : "May 21, 2016" ,
39+ "description" : "Curved claw steel hammer" ,
40+ "price" : 8.9 ,
41+ "starRating" : 4.8 ,
42+ "imageUrl" : "https://openclipart.org/image/300px/svg_to_png/73/rejon_Hammer.png"
43+ } ,
44+ {
45+ "productId" : 8 ,
46+ "productName" : "Saw" ,
47+ "productCode" : "TBX-0022" ,
48+ "releaseDate" : "May 15, 2016" ,
49+ "description" : "15-inch steel blade hand saw" ,
50+ "price" : 11.55 ,
51+ "starRating" : 3.7 ,
52+ "imageUrl" : "https://openclipart.org/image/300px/svg_to_png/27070/egore911_saw.png"
53+ } ,
54+ {
55+ "productId" : 10 ,
56+ "productName" : "Video Game Controller" ,
57+ "productCode" : "GMG-0042" ,
58+ "releaseDate" : "October 15, 2015" ,
59+ "description" : "Standard two-button video game controller" ,
60+ "price" : 35.95 ,
61+ "starRating" : 4.6 ,
62+ "imageUrl" : "https://openclipart.org/image/300px/svg_to_png/120337/xbox-controller_01.png"
63+ }
64+ ] ;
65+ toggleImage ( ) : void {
66+ this . showImage = ! this . showImage ;
67+ }
6168}
0 commit comments