Skip to content

Instantly share code, notes, and snippets.

@syntagmatic
Created May 8, 2012 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save syntagmatic/2631602 to your computer and use it in GitHub Desktop.
Save syntagmatic/2631602 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,
localStorage: new Store("Items-backbone")
});
// 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