generator-fountain-angular2
Version:
Yeoman Fountain generator to scaffold a webapp with Angular 2 written in ES6 (Babel), TypeScript through Webpack or SystemJS including tools Gulp 4, ESLint, Browsersync and Karma
31 lines (25 loc) • 731 B
text/typescript
import {Component, Input, Output, EventEmitter} from '@angular/core';
({
selector: 'fountain-todo-item',
template: require('./TodoItem.html')
})
export class TodoItemComponent {
() todo: any;
() onDestroy: EventEmitter<any> = new EventEmitter(false);
() onSave: EventEmitter<any> = new EventEmitter(false);
() onChange: EventEmitter<any> = new EventEmitter(false);
editing: boolean = false;
handleSave(text: string) {
this.onSave.emit({id: this.todo.id, text});
this.editing = false;
}
handleChange() {
this.onChange.emit(this.todo.id);
}
handleDoubleClick() {
this.editing = true;
}
handleClick() {
this.onDestroy.emit(this.todo.id);
}
}