-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
55 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,11 @@ | ||
<app-navigation></app-navigation> | ||
|
||
<main role="main"> | ||
<app-carousel></app-carousel> | ||
|
||
<div class="container"> | ||
<div class="row" > | ||
<app-license-plate *ngFor="let plate of licensePlates | async" appHighlight | ||
[plate]="plate" (onAddToCart)="addToCart($event)" buttonText="Add to cart" class="col-md-4"> | ||
</app-license-plate> | ||
</div> | ||
</div> | ||
<router-outlet></router-outlet> | ||
</main> | ||
|
||
<footer class="container"> | ||
<p>© License Plate Store 2017</p> | ||
</footer> | ||
|
||
<app-popup-window [isOpen]="showPopup" title="Item added to cart" (onClose)="showPopup = false" > | ||
Thanks for shopping with us! | ||
</app-popup-window> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,9 @@ | ||
import { Component } from '@angular/core'; | ||
import {LicensePlate} from './license-plate'; | ||
import {LicensePlateService} from './license-plate.service'; | ||
import {Observable} from 'rxjs'; | ||
import {CartService} from './cart.service'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html' | ||
}) | ||
export class AppComponent { | ||
|
||
licensePlates: Observable<LicensePlate[]>; | ||
showPopup = false; | ||
|
||
constructor(private service: LicensePlateService, private cartService: CartService) { | ||
this.licensePlates = this.service.getList(); | ||
} | ||
|
||
addToCart(plate: LicensePlate) { | ||
this.cartService.addToCart(plate) | ||
.subscribe(done => this.showPopup = true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
import { ModuleWithProviders } from '@angular/core'; | ||
import { Routes, RouterModule } from '@angular/router'; | ||
|
||
import {HelloComponent} from "./hello/hello.component"; | ||
import {StoreViewComponent} from './store-view/store-view.component'; | ||
import {CartViewComponent} from './cart-view/cart-view.component'; | ||
import {CheckoutViewComponent} from './checkout-view/checkout-view.component'; | ||
|
||
const appRoutes: Routes = [ | ||
{ | ||
path: '', component: HelloComponent | ||
path: '', component: StoreViewComponent | ||
}, | ||
{ | ||
path: 'cart', component: CartViewComponent | ||
}, | ||
{ | ||
path: 'checkout', component: CheckoutViewComponent | ||
} | ||
]; | ||
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<app-carousel></app-carousel> | ||
|
||
<div class="container"> | ||
<div class="row" > | ||
<app-license-plate *ngFor="let plate of licensePlates | async" appHighlight | ||
[plate]="plate" (onAddToCart)="addToCart($event)" buttonText="Add to cart" class="col-md-4"> | ||
</app-license-plate> | ||
</div> | ||
</div> | ||
|
||
<app-popup-window [isOpen]="showPopup" title="Item added to cart" (onClose)="showPopup = false" > | ||
Thanks for shopping with us! | ||
</app-popup-window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Component } from '@angular/core'; | ||
import {LicensePlate} from '../license-plate'; | ||
import {Observable} from 'rxjs/Observable'; | ||
import {LicensePlateService} from '../license-plate.service'; | ||
import {CartService} from '../cart.service'; | ||
|
||
@Component({ | ||
selector: 'app-store-view', | ||
templateUrl: './store-view.component.html', | ||
styleUrls: ['./store-view.component.css'] | ||
}) | ||
export class StoreViewComponent { | ||
|
||
licensePlates: Observable<LicensePlate[]>; | ||
showPopup = false; | ||
|
||
constructor(private service: LicensePlateService, private cartService: CartService) { | ||
this.licensePlates = this.service.getList(); | ||
} | ||
|
||
addToCart(plate: LicensePlate) { | ||
this.cartService.addToCart(plate) | ||
.subscribe(done => this.showPopup = true); | ||
} | ||
} |