2014-01-18 91 views
0

我試圖在documentation中描述的Rivets.js中執行迭代綁定。但似乎沒有綁定發生。Rivets.js遍歷集合

模板定義如下:

var model = { 
    list: { 
    todos: [ 
     { done: true, summary: "Todo 1" }, 
     { done: false, summary: "Todo 2" } 
    ] 
    } 
} 
rivets.bind(document.getElementById('rivets'), model) 

我創建了針對此問題的fiddle

<section id="rivets"> 
    <ul> 
    <li data-each-todo="list.todos"> 
     <input type="checkbox" data-checked="todo.done"> 
     <span data-text="todo.summary"></span> 
    </li> 
    <ul> 
</section> 

的結合是由執行。我錯過了什麼?

回答

0

我的不好 - Rivets.js文檔的第一段使我使用錯誤的Rivets.js屬性名稱(data-而不是rv-)。