rv-each updating w/simple object

by dswitzer

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.3.3/backbone-min.js"></script>
<script src="https://raw.githubusercontent.com/mikeric/rivets/v0.9.4/dist/rivets.bundled.min.js"></script>
<div id="view">
  <ul>
    <li rv-each-user="users" rv-text="user.name" />
  </ul>
</div>

<button onclick="changeList();">
Change List
</button>

JavaScript

function onready(){
	window.users = [{id: 1, name: "Howard"}, {id: 2, name: "Fred"}, {id: 3, name: "Robin"}];
	window.view = rivets.bind(document.getElementById("view"), {users:window.users});
}

function changeList(){
	var users = [{id: 4, name: "Gary"}, {id: 5, name: "Benji"}, {id: 6, name: "John"}, {id: 7, name: "Richard"}, {id: 8, name: "Sal"}];
  window.view.update({users:users});
}

onready();