Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Include Id In Backbone

  var Meal = Backbone.Model.extend({
  idAttribute: "_id"
});

var cake = new Meal({ _id: 1, name: "Cake" });

         Backbone.sync = function(method, model) {  

console.log(model.id);

         }
 cake.save();
 
PREVIOUS NEXT
Tagged: #Include #Id #In #Backbone
ADD COMMENT
Topic
Name
8+9 =