Skip to content

Instantly share code, notes, and snippets.

@kyuwoo-choi
Created May 28, 2018 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyuwoo-choi/bb329cfce5373fa09b5a553fd98b149f to your computer and use it in GitHub Desktop.
Save kyuwoo-choi/bb329cfce5373fa09b5a553fd98b149f to your computer and use it in GitHub Desktop.
// todoList.js
render() {
...
const todoItems = todoList
.filter(todo => {
return (
route === '' ||
(route === 'completed' && todo.completed) ||
(route === 'active' && !todo.completed)
);
})
.map(todo => html`<todo-item todo=${todo}></todo-item>`);
return html`
${style}
<div class="todo">
${btnToggleAll}
<div class="todo-list">
${todoItems}
</div>
</div>
`;
}
...
// todoItem.js
set todo(todo) {
this._todo = todo;
this.invalidate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment