Outline the duck editor

Signed-off-by: Gergely Polonkai <gergely@polonkai.eu>
This commit is contained in:
Gergely Polonkai 2016-09-06 13:53:32 +02:00
parent 4db5923857
commit 09ea2073dd
4 changed files with 28 additions and 2 deletions

View File

@ -1 +1,12 @@
<h1>Hello!</h1>
<div>
<div>
<label>id:</label>
{{ duck.id }}
</div>
<div>
<label>color:</label>
<input [(ngModel)]="duck.color" placeholder="Color">
</div>
</div>
{{ duck.color }}

View File

@ -1,7 +1,14 @@
import { Component } from "@angular/core";
import { Duck } from "./models";
@Component({
selector: "duckbook-front",
templateUrl: "/app/app.component.html"
})
export class AppComponent {}
export class AppComponent {
duck: Duck = {
id: 1,
color: 'yellow'
};
}

View File

@ -1,10 +1,14 @@
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { FormsModule } from "@angular/forms";
import { AppComponent } from "./app.component";
@NgModule({
imports: [ BrowserModule ],
imports: [
BrowserModule,
FormsModule
],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})

4
app/models.ts Normal file
View File

@ -0,0 +1,4 @@
export class Duck {
id: number;
color: string;
}