2015-12-23 09:42:57 -08:00
|
|
|
// #docregion
|
2016-04-27 11:28:22 -07: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 09:42:57 -08: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 13:31:27 +01:00
|
|
|
`
|
2015-12-16 21:47:02 -05:00
|
|
|
})
|
|
|
|
export class HeroDetailComponent {
|
2016-03-24 13:31:27 +01:00
|
|
|
@Input() hero: Hero;
|
2015-12-16 21:47:02 -05:00
|
|
|
}
|