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
38 lines (32 loc) • 775 B
JavaScript
var ng = require('@angular/core');
module.exports = ng.Component({
selector: 'fountain-todo-item',
template: require('./TodoItem.html'),
inputs: ['todo'],
outputs: [
'onDestroy',
'onSave',
'onChange'
]
})
.Class({
constructor: function () {
this.onDestroy = new ng.EventEmitter(false);
this.onSave = new ng.EventEmitter(false);
this.onChange = new ng.EventEmitter(false);
this.editing = false;
},
handleSave: function (text) {
this.onSave.emit({id: this.todo.id, text: text});
this.editing = false;
},
handleChange: function () {
this.onChange.emit(this.todo.id);
},
handleDoubleClick: function () {
this.editing = true;
},
handleClick: function () {
this.onDestroy.emit(this.todo.id);
}
});