| 12345678910111213141516171819202122232425 |
- import { Component } from "@angular/core";
- import { Router } from "@angular/router";
- import { Store } from "../services/store.service";
- @Component({
- selector: "checkout",
- templateUrl: "checkout.component.html",
- styleUrls: ['checkout.component.css']
- })
- export class Checkout {
- public errorMessage = "";
- constructor(public store: Store, private router: Router) {}
- onCheckout() {
- this.errorMessage = "";
- this.store.checkout()
- .subscribe(() => {
- this.router.navigate(["/"]);
- }, err => {
- this.errorMessage = `Failed to checkout: ${err}`;
- });
- }
- }
|