angular-nevera-generator
Version:
Yeoman AngularJS scaffold a webapp with Angular 1 written in ES6 (Babel), TypeScript through Webpack or SystemJS including tools Gulp 4, ESLint, Browsersync and Karma
38 lines (33 loc) • 599 B
text/typescript
class TodoItem {
editing: boolean = false;
onSave: Function;
onDestroy: Function;
todo: any;
handleDoubleClick() {
this.editing = true;
}
handleSave(text: string) {
this.onSave({
todo: {
text,
id: this.todo.id
}
});
this.editing = false;
}
handleDestroy(id: number) {
this.onDestroy({id});
}
}
angular
.module('app')
.component('todoItem', {
templateUrl: 'app/components/TodoItem.html',
controller: TodoItem,
bindings: {
todo: '<',
onDestroy: '&',
onChange: '&',
onSave: '&'
}
});