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
39 lines (34 loc) • 649 B
JavaScript
module.exports = {
<% if (modules === 'systemjs') { -%>
templateUrl: 'app/components/TodoItem.html',
<% } else { -%>
template: require('./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});
}
};