Skip to content

Instantly share code, notes, and snippets.

@juliankrispel
Last active December 14, 2015 04:49
Show Gist options
  • Save juliankrispel/5030779 to your computer and use it in GitHub Desktop.
Save juliankrispel/5030779 to your computer and use it in GitHub Desktop.
Backbone Notes

#Backbone Notes

##Backbone Modelbinder

  • NEVER EVER attach an instance of ModelBinder to a Class. I've done this mistake multiple times now always forgetting that it's a class and not an object.

##Model Attributes

You can assign a function to an attribute, this is very handy if you wanted to for example assign the current date to a new item

var Model = Backbone.Model.extend({
    defaults: {
        someAttribute: (function(){ return 1 + 1; })()
    }
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment