import { Component , ChangeDetectionStrategy , EventEmitter , Input , Output } from '@angular/core' ; import { Hero } from '../../core' ; @ Component ( { selector : 'aw-hero-list' , templateUrl : './hero-list.component.html' , styleUrls : [ './hero-list.component.scss' ] , changeDetection : ChangeDetectionStrategy . OnPush } ) export class HeroListComponent { @ Input ( ) heroes : Hero [ ] ; @ Input ( ) selectedHero : Hero ; @ Output ( ) deleted = new EventEmitter < Hero > ( ) ; @ Output ( ) selected = new EventEmitter < Hero > ( ) ; byId ( hero ) { return hero . id ; } onSelect ( hero ) { this . selected . emit ( hero ) ; } deleteHero ( hero ) { this . deleted . emit ( hero ) ; } }