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
27 lines (24 loc) • 522 B
JavaScript
angular
.module('app')
.component('headerComponent', {
templateUrl: 'app/components/Header.html',
<% if (modules === 'systemjs') { -%>
controller: ['todoService', Header],
<% } else { -%>
controller: Header,
<% } -%>
bindings: {
todos: '='
}
});
/** @ngInject */
function Header(todoService) {
this.todoService = todoService;
}
Header.prototype = {
handleSave: function (text) {
if (text.length !== 0) {
this.todos = this.todoService.addTodo(text, this.todos);
}
}
};