2015-12-23 12:42:57 -05:00
|
|
|
// #docregion
|
2016-04-27 14:28:22 -04:00
|
|
|
import {Component, Input} from '@angular/core';
|
2015-12-16 21:47:02 -05:00
|
|
|
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>
|
2015-12-16 21:47:02 -05:00
|
|
|
<div>
|
|
|
|
<label>name: </label>
|
|
|
|
<input [(ngModel)]="hero.name" placeholder="name"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-03-24 08:31:27 -04:00
|
|
|
`
|
2015-12-16 21:47:02 -05:00
|
|
|
})
|
|
|
|
export class HeroDetailComponent {
|
2016-03-24 08:31:27 -04:00
|
|
|
@Input() hero: Hero;
|
2015-12-16 21:47:02 -05:00
|
|
|
}
|