Created
May 19, 2013 04:36
-
-
Save marti1125/5606707 to your computer and use it in GitHub Desktop.
Backbone 02 codeschool
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
var Appointment = Backbone.Model.extend({ | |
defaults: function (){ | |
return { | |
title: 'Checkup', | |
date: new Date() | |
} | |
} | |
}); | |
var Appointment = Backbone.Model.extend({urlRoot: '/appointments'}); | |
var appointment = new Appointment({id:1}) | |
appointment.fetch(); | |
appointment.set({cancelled: true}) | |
appointment.save(); | |
appointment.on('change:cancelled', function(){ | |
alert("Hey Dr. Goodparts, your appointment has changed!"); | |
}); | |
console.log(appointment.toJSON()); //get all data into json format |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment