// #docplaster
import {Component, Input, Output, EventEmitter} from 'angular2/core';
import {Hero} from './hero';
let nextHeroDetailId = 1;
// #docregion input-output-2
@Component({
// #enddocregion input-output-2
selector: 'hero-detail',
// #docregion input-output-2
inputs: ['hero'],
outputs: ['deleted'],
// #enddocregion input-output-2
template: `
`
// #docregion input-output-2
})
// #enddocregion input-output-2
export class HeroDetailComponent {
hero: Hero;
// #docregion deleted
deleted = new EventEmitter();
onDelete() {
this.deleted.emit(this.hero);
}
// #enddocregion
// heroImageUrl = 'http://www.wpclipart.com/cartoon/people/hero/hero_silhoutte_T.png';
// Public Domain terms of use: http://www.wpclipart.com/terms.html
heroImageUrl = 'images/hero.png';
id = nextHeroDetailId++;
}
@Component({
selector: 'big-hero-detail',
template: `
{{hero?.fullName}}
First: {{hero?.firstName}}
Last: {{hero?.lastName}}
Birthdate: {{hero?.birthdate | date:'longDate'}}
Rate/hr: {{hero?.rate | currency:'EUR'}}
`
})
export class BigHeroDetailComponent extends HeroDetailComponent {
// #docregion input-output-1
@Input() hero: Hero;
@Output() deleted = new EventEmitter();
// #enddocregion input-output-1
onDelete() {
this.deleted.emit(this.hero);
}
}