angular-docs-cn/public/docs/_examples/toh-4/ts/app/hero-detail.component.ts

23 lines
470 B
TypeScript
Raw Normal View History

2015-12-23 12:42:57 -05:00
// #docregion
import { Component, Input } from '@angular/core';
import { Hero } from './hero';
@Component({
selector: 'my-hero-detail',
template: `
<div *ngIf="hero">
2015-12-23 12:42:57 -05:00
<h2>{{hero.name}} details</h2>
<div>
<label>id: </label>{{hero.id}}
</div>
<div>
<label>name: </label>
<input [(ngModel)]="hero.name" placeholder="name"/>
</div>
</div>
`
})
export class HeroDetailComponent {
@Input() hero: Hero;
}