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
37 lines (32 loc) • 599 B
JavaScript
angular
.module('app')
.component('todoItem', {
templateUrl: 'app/components/TodoItem.html',
controller: TodoItem,
bindings: {
todo: '<',
onDestroy: '&',
onChange: '&',
onSave: '&'
}
});
function TodoItem() {
this.editing = false;
}
TodoItem.prototype = {
handleDoubleClick: function () {
this.editing = true;
},
handleSave: function (text) {
this.onSave({
todo: {
text: text,
id: this.todo.id
}
});
this.editing = false;
},
handleDestroy: function (id) {
this.onDestroy({id: id});
}
};