Created
April 3, 2017 14:53
-
-
Save t4t5/4981c78149d51ff11eaaf840551c826b to your computer and use it in GitHub Desktop.
todo-list-component-2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/ui/components/todo-list/component.ts | |
import Component, { tracked } from "@glimmer/component"; | |
export default class TodoList extends Component { | |
@tracked newItemText = ''; | |
@tracked items = [ | |
{ | |
text: "Install Glimmer", | |
isDone: false, | |
}, | |
{ | |
text: "Build app", | |
isDone: false, | |
}, | |
{ | |
text: "Bro down", | |
isDone: false, | |
} | |
]; | |
updateNewItemText(e) { | |
this.newItemText = e.target.value; | |
} | |
addItem() { | |
if (!this.newItemText) return false; | |
let items = [ | |
...this.items, | |
{ | |
text: this.newItemText, | |
isDone: false, | |
}, | |
]; | |
this.items = items; | |
this.newItemText = ''; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment