From: Kai Moritz Date: Sat, 21 Dec 2019 12:34:32 +0000 (+0100) Subject: Cart-Seite aus Tutorial implementiert X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=6488b34b5f23a7372b3f9054e998a137961b971f;p=examples%2Fangular-tutorial Cart-Seite aus Tutorial implementiert --- diff --git a/src/app/cart/cart.component.html b/src/app/cart/cart.component.html index 6bdabc8..222ee9d 100644 --- a/src/app/cart/cart.component.html +++ b/src/app/cart/cart.component.html @@ -1 +1,6 @@ -

cart works!

+

Cart

+ +
+ {{ item.name }} + {{ item.price | currency }} +
diff --git a/src/app/cart/cart.component.ts b/src/app/cart/cart.component.ts index c9276d4..500bd05 100644 --- a/src/app/cart/cart.component.ts +++ b/src/app/cart/cart.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { CartService } from '../cart.service'; @Component({ selector: 'app-cart', @@ -7,9 +8,12 @@ import { Component, OnInit } from '@angular/core'; }) export class CartComponent implements OnInit { - constructor() { } + items; + + constructor(private cartService: CartService) { } ngOnInit() { + this.items = this.cartService.getItems(); } }