Created
February 9, 2015 02:17
-
-
Save stuarthannig/cebc80fdae81cea3af5b to your computer and use it in GitHub Desktop.
Backbone Model Defaults
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
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