From f7bf483aa7e52be987df5bc890f829c97151c219 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 6 Sep 2016 14:07:33 +0200 Subject: [PATCH] Change the duck to a list of ducks, finalize editor Signed-off-by: Gergely Polonkai --- app/app.component.html | 13 +++++++++---- app/app.component.ts | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/app.component.html b/app/app.component.html index 07375e7..1cc53e6 100644 --- a/app/app.component.html +++ b/app/app.component.html @@ -1,12 +1,17 @@

Hello!

-
+
- {{ duck.id }} + {{ selectedDuck.id }}
- +
-{{ duck.color }} + +
    +
  • + {{ duck.color }} +
  • +
diff --git a/app/app.component.ts b/app/app.component.ts index 367d117..2f6eeef 100644 --- a/app/app.component.ts +++ b/app/app.component.ts @@ -2,11 +2,25 @@ import { Component } from "@angular/core"; import { Duck } from "./models"; +const DUCKS: Ducks[] = [ + { id: 1, color: 'yellow' }, + { id: 2, color: 'blue' }, + { id: 3, color: 'pink' } +] + @Component({ selector: "duckbook-front", templateUrl: "/app/app.component.html" }) export class AppComponent { + ducks = DUCKS; + selectedDuck: Duck; + + onSelect(duck: Duck): void { + console.log(duck); + this.selectedDuck = duck; + } + duck: Duck = { id: 1, color: 'yellow'