看来,该文章的作者忘记了几个步骤。需要todos.js文件,包括一些修改,以确保:文本变量(在Backbone.js的待办事项例子)变更为:内容
例如的setText功能
var text = this.model.get('content');
关闭功能
// Close the `"editing"` mode, saving changes to the todo.
close: function() {
this.model.save({content: this.input.val()});
$(this.el).removeClass("editing");
},
和createOnEnter功能
// create new **Todo** model persisting it to *localStorage*.
createOnEnter: function(e) {
var text = this.input.val();
if (!text || e.keyCode != 13) return;
Todos.create({content: text});
this.input.val('');
},
来源
2011-08-25 03:37:45
Jon
我理解了它...的instructio ns忘记了需要更新Todo.js以确保示例Todo应用中的:text变量已更新为:content。所以,如果不设置它将默认值发送到服务器的值(我从json文章中知道) – Jon