File tree Expand file tree Collapse file tree 4 files changed +82
-2
lines changed Expand file tree Collapse file tree 4 files changed +82
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { Component } from '@angular/core';
4
4
selector : 'pm-root' ,
5
5
template : `
6
6
<div><h1>{{pageTitle}}</h1>
7
- <div>My First Component</div >
7
+ <pm-products></pm-products >
8
8
</div>
9
9
`
10
10
} )
Original file line number Diff line number Diff line change @@ -2,10 +2,12 @@ import { BrowserModule } from '@angular/platform-browser';
2
2
import { NgModule } from '@angular/core' ;
3
3
4
4
import { AppComponent } from './app.component' ;
5
+ import { ProductListComponent } from './products/product-list.component' ;
5
6
6
7
@NgModule ( {
7
8
declarations : [
8
- AppComponent
9
+ AppComponent ,
10
+ ProductListComponent
9
11
] ,
10
12
imports : [
11
13
BrowserModule
Original file line number Diff line number Diff line change
1
+ < div class ='panel panel-primary '>
2
+ < div class ='panel-heading '>
3
+ {{pageTitle}}
4
+ </ div >
5
+ < div class ='panel-body '>
6
+ < div class ='row '>
7
+ < div class ='col-md-2 '> Filter by:</ div >
8
+ < div class ='col-md-4 '>
9
+ < input type ='text ' />
10
+ </ div >
11
+ </ div >
12
+ < div class ='row '>
13
+ < div class ='col-md-6 '>
14
+ < h3 > Filtered by: </ h3 >
15
+ </ div >
16
+ </ div >
17
+ < div class ='table-responsive '>
18
+ < table class ='table '
19
+ *ngIf ='products && products.length '>
20
+ < thead >
21
+ < tr >
22
+ < th >
23
+ < button class ='btn btn-primary '>
24
+ Show Image
25
+ </ button >
26
+ </ th >
27
+ < th > Product</ th >
28
+ < th > Code</ th >
29
+ < th > Available</ th >
30
+ < th > Price</ th >
31
+ < th > 5 Star Rating</ th >
32
+ </ tr >
33
+ </ thead >
34
+ < tbody >
35
+ < tr *ngFor ='let product of products '>
36
+ < td > </ td >
37
+ < td > {{ product.productName }}</ td >
38
+ < td > {{ product.productCode }}</ td >
39
+ < td > {{ product.releaseDate }}</ td >
40
+ < td > {{ product.price }}</ td >
41
+ < td > {{ product.starRating }}</ td >
42
+ </ tr >
43
+ </ tbody >
44
+ </ table >
45
+ </ div >
46
+ </ div >
47
+ </ div >
Original file line number Diff line number Diff line change
1
+ import { Component } from '@angular/core' ;
2
+
3
+ @Component ( {
4
+ selector : 'pm-products' ,
5
+ templateUrl : './product-list.component.html'
6
+ } )
7
+ export class ProductListComponent {
8
+ pageTitle : string = 'Product List' ;
9
+ products : any [ ] = [
10
+ {
11
+ "productId" : 2 ,
12
+ "productName" : "Garden Cart" ,
13
+ "productCode" : "GDN-0023" ,
14
+ "releaseDate" : "March 18, 2016" ,
15
+ "description" : "15 gallon capacity rolling garden cart" ,
16
+ "price" : 32.99 ,
17
+ "starRating" : 4.2 ,
18
+ "imageUrl" : "http://openclipart.org/image/300px/svg_to_png/58471/garden_cart.png"
19
+ } ,
20
+ {
21
+ "productId" : 5 ,
22
+ "productName" : "Hammer" ,
23
+ "productCode" : "TBX-0048" ,
24
+ "releaseDate" : "May 21, 2016" ,
25
+ "description" : "Curved claw steel hammer" ,
26
+ "price" : 8.9 ,
27
+ "starRating" : 4.8 ,
28
+ "imageUrl" : "http://openclipart.org/image/300px/svg_to_png/73/rejon_Hammer.png"
29
+ }
30
+ ] ;
31
+ }
You can’t perform that action at this time.
0 commit comments