Created
May 8, 2012 00:16
-
-
Save syntagmatic/2631602 to your computer and use it in GitHub Desktop.
Basic Backbone Collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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