Skip to content

Instantly share code, notes, and snippets.

@JaySunSyn

JaySunSyn/todo-list.html

Last active Jan 17, 2018
Embed
What would you like to do?
Step 2
<link rel="import" href="../bower_components/polymer/polymer-element.html">
<link rel="import" href="../bower_components/polymer/lib/elements/dom-repeat.html">
<link rel="import" href="redux/redux-mixin.html">
<dom-module id="todo-list">
<template>
<ul>
<template is="dom-repeat" items="[[todos]]" as="todo">
<li on-click="_remove">[[todo.text]] <span style="color: white">Remove</span></li>
</template>
</ul>
</template>
<script>
class TodoList extends App.ReduxMixin(Polymer.Element) {
static get is() {
return 'todo-list';
}
static get properties() {
return {
todos: {
type: Array,
statePath: App.select.todos,
},
};
}
_remove(e) {
this.dispatch(App.actions.remove(e.model.todo));
}
}
window.customElements.define(TodoList.is, TodoList);
</script>
</dom-module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment