Tutorial by Examples

To create a new collection "class": var Books = Backbone.Collection.extend({ // books will be sorted by title comparator: "title", initialize: function(models, options) { options = options || {}; // (Optional) you can play with the models her...
We need to define a collection with a url property. This is the url to an API endpoint which should return a json formatted array. var Books = Backbone.Collection.extend({ url: "/api/book", comparator: "title", }); Then, within a view, we'll fetch and render asynch...
By default, the url property is not defined. Calling fetch() (while using the default Backbone.sync) will result in a GET request to the results of url. var Users = Backbone.Collection.extend({ url: '/api/users', // or url: function () { return '/api/users' } }); va...

Page 1 of 1