Skip to content

Commit 7c3b835

Browse files
chrisvfritzposva
authored andcommitted
add item updates to the todo-app example (#37)
* add item updates to the todo-app example * simplify update example based on feedback
1 parent a14f98d commit 7c3b835

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/todo-app/index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
the latest published version of VueFire, you
2222
play with the code in this fiddle:
2323
24-
https://jsfiddle.net/chrisvfritz/acy5n6j6/
24+
https://jsfiddle.net/posva/wtyop5jy/
2525
-->
2626

2727
<div id="app">
@@ -32,7 +32,10 @@
3232
>
3333
<ul>
3434
<li v-for="todo in todos">
35-
{{ todo.text }}
35+
<input
36+
:value="todo.text"
37+
@input="updateTodoText(todo, $event.target.value)"
38+
>
3639
<button @click="removeTodo(todo)">X</button>
3740
</li>
3841
</ul>
@@ -62,6 +65,9 @@
6265
this.newTodoText = ''
6366
}
6467
},
68+
updateTodoText: function (todo, newText) {
69+
todosRef.child(todo['.key']).child('text').set(newText)
70+
},
6571
removeTodo: function (todo) {
6672
todosRef.child(todo['.key']).remove()
6773
}

0 commit comments

Comments
 (0)