Created
January 25, 2017 08:36
-
-
Save martsie/8b5e39890be4798538e2139f260f681d to your computer and use it in GitHub Desktop.
Backbone collection in CoffeeScript
This file contains hidden or 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
# Define the collection. | |
class CommentCollection extends Backbone.Collection | |
model: Comment | |
# Create a new instance of the collection. | |
comments = new CommentCollection | |
# Add a few comments to the collection. | |
collection.add [ | |
{name: 'Comment 1'}, | |
{name: 'Comment 2'}, | |
{name: 'Comment 3'} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment