Skip to content

Instantly share code, notes, and snippets.

@stuarthannig
Created February 9, 2015 02:17
Show Gist options
  • Save stuarthannig/cebc80fdae81cea3af5b to your computer and use it in GitHub Desktop.
Save stuarthannig/cebc80fdae81cea3af5b to your computer and use it in GitHub Desktop.
Backbone Model Defaults
var Appointment = Backbone.Model.extend({
defaults: {
title: 'Checkup'
}
});
# Or cause the defaults to get evaluated every time a new instance is created
var Appointment = Backbone.Model.extend({
defaults: function() {
return {
title: 'Checkup',
date: new Date()
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment