2015-12-16 19:38:07 -08:00
|
|
|
// #docplaster
|
|
|
|
// #docregion
|
|
|
|
// #docregion v1
|
2016-03-24 13:31:27 +01:00
|
|
|
import {Component, Input} from 'angular2/core';
|
|
|
|
|
2015-12-16 19:38:07 -08:00
|
|
|
// #enddocregion v1
|
|
|
|
// #docregion hero-import
|
|
|
|
import {Hero} from './hero';
|
|
|
|
// #enddocregion hero-import
|
2015-12-14 20:05:13 -08:00
|
|
|
|
2015-12-16 19:38:07 -08:00
|
|
|
// #docregion v1
|
2015-12-14 20:05:13 -08:00
|
|
|
@Component({
|
|
|
|
selector: 'my-hero-detail',
|
2016-03-24 13:31:27 +01:00
|
|
|
// #enddocregion v1
|
2015-12-16 19:38:07 -08:00
|
|
|
// #docregion template
|
2015-12-14 20:05:13 -08:00
|
|
|
template: `
|
|
|
|
<div *ngIf="hero">
|
|
|
|
<h2>{{hero.name}} details!</h2>
|
|
|
|
<div><label>id: </label>{{hero.id}}</div>
|
|
|
|
<div>
|
|
|
|
<label>name: </label>
|
|
|
|
<input [(ngModel)]="hero.name" placeholder="name"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-03-24 13:31:27 +01:00
|
|
|
`
|
2015-12-16 19:38:07 -08:00
|
|
|
// #enddocregion template
|
2016-03-24 13:31:27 +01:00
|
|
|
// #docregion v1
|
2015-12-14 20:05:13 -08:00
|
|
|
})
|
|
|
|
export class HeroDetailComponent {
|
2015-12-16 19:38:07 -08:00
|
|
|
// #enddocregion v1
|
2016-03-24 13:31:27 +01:00
|
|
|
// #docregion hero-input
|
|
|
|
@Input()
|
|
|
|
// #docregion hero
|
2015-12-23 09:42:57 -08:00
|
|
|
hero: Hero;
|
2016-03-24 13:31:27 +01:00
|
|
|
// #enddocregion hero
|
|
|
|
// #enddocregion hero-input
|
2015-12-16 19:38:07 -08:00
|
|
|
// #docregion v1
|
2015-12-14 20:05:13 -08:00
|
|
|
}
|
2015-12-16 19:38:07 -08:00
|
|
|
// #enddocregion v1
|