$(document).ready(function () {
people = Backbone.Collection([
{name: "Tim", age: 5},
{name: "Ida", age: 26},
{name: "Rob", age: 55}
]);
alert(JSON.stringify(people));
});
verursacht
Uncaught exception: TypeError: 'this._reset' is not a function
Error thrown at line 23465, column 4 in <anonymous function: Backbone.Collection>(models, options) in http://127.0.0.1:8000/webapp/app.js:
this._reset();
called from line 481, column 2 in <anonymous function>() in http://127.0.0.1:8000/:
people = Backbone.Collection([
Backbone 1.1.0, Underscore 1.5.2 (das gleiche mit lodash).
Sie haben vergessen, new
vor Backbone.Collection
zu setzen.
Ups, ich bin dumm. Ich denke, das passiert, wenn Sie gleichzeitig in mehreren Sprachen programmieren - Sie vergessen hin und wieder kleine, aber wichtige Dinge.
Vielen Dank für Ihre Hilfe.
Hilfreichster Kommentar
Sie haben vergessen,
new
vorBackbone.Collection
zu setzen.