import { Component , Input , Output , EventEmitter } from '@angular/core' ; import { Todo } from '../../domain/entities' ; @ Component ( { selector : 'app-todo-list' , templateUrl : './todo-list.component.html' , styleUrls : [ './todo-list.component.css' ] } ) export class TodoListComponent { _todos : Todo [ ] = [ ] ; @ Input ( ) set todos ( todos ) { if ( todos !== null ) this . _todos = [ ... todos ] ; } get todos ( ) { return this . _todos ; } @ Output ( ) onRemoveTodo = new EventEmitter < Todo > ( ) ; @ Output ( ) onToggleTodo = new EventEmitter < Todo > ( ) ; @ Output ( ) onToggleAll = new EventEmitter < boolean > ( ) ; onRemoveTriggered ( todo ) { this . onRemoveTodo . emit ( todo ) ; } onToggleTriggered ( todo ) { this . onToggleTodo . emit ( todo ) ; } onToggleAllTriggered ( ) { this . onToggleAll . emit ( true ) ; } }