Skip to content

Instantly share code, notes, and snippets.

@colevscode
Forked from syntagmatic/model.js
Created May 8, 2012 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colevscode/2631827 to your computer and use it in GitHub Desktop.
Save colevscode/2631827 to your computer and use it in GitHub Desktop.
Basic Backbone Collection
// Model Definition
var Item = Backbone.Model.extend({
defaults: function() {
return {
text: "lorem ipsum"
}
},
});
// Collection Definition
var ItemList = Backbone.Collection.extend({
model: Item,
url: 'backlift/items'
});
// Create a Collection
var items = new ItemList;
// Fetch the collection
items.fetch();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment