fork download
  1. var Photo = Backbone.Model.extend({
  2. validate: function (attribs) {
  3. if (attribs.src === undefined) {
  4. return "Remember to set a source for your image!";
  5. }
  6. },
  7. initialize: function () {
  8. console.log('this model has been initialized');
  9. this.on("error", function (model, error) {
  10. console.log(error);
  11. });
  12. }
  13. });
  14. var myPhoto = new Photo();
  15. myPhoto.set({ title: "On the beach" });
  16. //logs Remember to set a source for your image!
Not running #stdin #stdout 0s 0KB
stdin
stdout
Standard output is empty