I am trying to learn Backbone.js
He worked on GET, PUT and DELETE for one model. But when I create the collection, the fetch method gives this error: Uncaught TypeError: Cannot read the 'idAttribute' property from undefined (backbone.js: 683)
Here is the code I'm trying to do:
Person = Backbone.Model.extend({ urlRoot: '/people' }); PersonList = Backbone.Collection.extend({ model: 'Person', url: '/people' }); var personList = new PersonList(); personList.fetch();
When retrieving, the server returns the following JSON, which, in my opinion, is correct:
[{"id":1,"name":"Matt","description":"Worker"},{"id":3,"name":"Test","description":"Test person"}]
I am using jQuery 2.0.3 (also tried 1.10.2), Underscore.js 1.5.2 and Backbone.js 1.1.0
What am I doing wrong?
source share