
今天用Backbone做dome时出现了一个错误:
1
|
Uncaught Error: A "url" property or function must be specified
|
在网上查了很多资料发现是使用Collection 时 url 没填的原因:
1 2 3 4 5 6 7 8 9 10 11
|
app.TodoCollection = Backbone.Collection.extend({ model:app.Todo, //url: 需要填写字符串地址 localStroage: new Backbone.LocalStorage('todo'), getCompleted: function () { return this.filter(function (todo) { return todo.get('completed') === true; }); },
|
近期评论