Skip to content

Instantly share code, notes, and snippets.

@lydemann
Last active June 16, 2020 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lydemann/cc75ed07f934aa4051c848400e7e228f to your computer and use it in GitHub Desktop.
Save lydemann/cc75ed07f934aa4051c848400e7e228f to your computer and use it in GitHub Desktop.
crud-item.component.ts
@Component({
selector: 'app-crud-item',
templateUrl: './crud-item.component.html',
styleUrls: ['./crud-item.component.scss'],
})
export class CrudItemComponent {
@Input() public todoItem: TodoItem;
@Input() public isReadOnly: boolean;
@Input() public dueDateText: string = 'add-todo.due-date';
@Input() public completeBtnText: string = 'todo-item.complete';
@Input() public editBtnText: string = 'todo-item.edit';
@Input() public deleteBtnText: string = 'todo-item.delete';
@Output() public todoDelete = new EventEmitter();
@Output() public todoEdit = new EventEmitter();
@Output() public todoCompleteToggled = new EventEmitter<string>();
public completeClick() {
this.todoCompleteToggled.emit(this.todoItem.id);
}
public deleteClick() {
this.todoDelete.emit(this.todoItem.id);
}
public editClick() {
this.todoEdit.emit(this.todoItem);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment