import { Component , Input , ChangeDetectionStrategy } from '@angular/core' ; import { Observable } from 'rxjs/Observable' ; import { IAnimal } from '../model' ; @ Component ( { selector : 'zoo-animal-list' , templateUrl : './component.html' , styleUrls : [ './component.css' ] , changeDetection : ChangeDetectionStrategy . OnPush , } ) export class AnimalListComponent { @ Input ( ) animalsName : string ; @ Input ( ) animalType : string ; @ Input ( ) animals : Observable < IAnimal [ ] > ; @ Input ( ) loading : Observable < boolean > ; @ Input ( ) error : Observable < any > ; getKey ( _ , animal ) { return animal . id ; } }