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
40 lines (35 loc) • 703 B
text/typescript
class TodoItemController {
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});
}
}
export const TodoItem: angular.IComponentOptions = {
<% if (modules === 'systemjs') { -%>
templateUrl: 'app/components/TodoItem.html',
<% } else { -%>
template: require('./TodoItem.html'),
<% } -%>
controller: TodoItemController,
bindings: {
todo: '<',
onDestroy: '&',
onChange: '&',
onSave: '&'
}
};