Skip to content

Instantly share code, notes, and snippets.

@daGrevis
Created March 25, 2013 19:56
Show Gist options
  • Select an option

  • Save daGrevis/5240127 to your computer and use it in GitHub Desktop.

Select an option

Save daGrevis/5240127 to your computer and use it in GitHub Desktop.
jQuery ->
class MyModel extends Backbone.Model
parse: (response) ->
response.objects
class ItemModel extends MyModel
class ItemsCollection extends Backbone.Collection
url: "/api/v1/item/"
model: ItemModel
class CategoryModel extends Backbone.Model
class CategoriesCollection extends Backbone.Collection
model: ItemModel
class ItemsView extends Backbone.View
el: $ "#items"
initialize: ->
_.bindAll @
@items_collection = new ItemsCollection
@items_collection.on "sync", @render
@items_collection.fetch()
render: ->
$(@el).text "Hello, world!"
items_view = new ItemsView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment