Skip to content

Commit 4a34d4f

Browse files
committed
As of Module 4
1 parent d38b540 commit 4a34d4f

File tree

4 files changed

+82
-2
lines changed

4 files changed

+82
-2
lines changed

APM-CLI-Final/src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Component } from '@angular/core';
44
selector: 'pm-root',
55
template: `
66
<div><h1>{{pageTitle}}</h1>
7-
<div>My First Component</div>
7+
<pm-products></pm-products>
88
</div>
99
`
1010
})

APM-CLI-Final/src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import { BrowserModule } from '@angular/platform-browser';
22
import { NgModule } from '@angular/core';
33

44
import { AppComponent } from './app.component';
5+
import { ProductListComponent } from './products/product-list.component';
56

67
@NgModule({
78
declarations: [
8-
AppComponent
9+
AppComponent,
10+
ProductListComponent
911
],
1012
imports: [
1113
BrowserModule
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
}

0 commit comments

Comments
 (0)