Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <ul id="todo">
  2. <li rv-each-todo="list.todos">
  3. <input type="checkbox" rv-idx="todo.idx" rv-checked="todo.done">
  4. <span>{ todo.summary }</span>
  5. </li>
  6. <ul>
  7.  
  8. <input rv-editing-idx="133"></input>
  9.  
  10. <ul id="todo">
  11. <li rv-each-todo="list.todos">
  12. <input type="radio" rv-idx="todo.idx" rv-checked="todo.done" name="todo" rv-on-change="list.change">
  13. <span>{ todo.summary }</span>
  14. </li>
  15. <ul>
  16.  
  17. <input id="changeele" rv-value="summary"></input>
  18.  
  19. var ele = document.getElementById('changeele');
  20. var eleBinding = rivets.bind(ele, {});
  21.  
  22. var list = {
  23. "todos": [
  24. {"idx":133, "done":true,"summary":"Eat"},
  25. {"idx":25, "done":false,"summary":"Code"},
  26. {"idx":33, "done":false,"summary":"Sleep"},
  27. {"idx":24, "done":false,"summary":"Repeat"}
  28. ],
  29. "change": function(event, scope) {
  30. eleBinding.unbind();
  31. eleBinding = rivets.bind(ele, scope.list.todos[scope.index]);
  32. }
  33. }
  34.  
  35. rivets.bind(document.getElementById('todo'), {list: list})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement