Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var DirectionModel = Backbone.Model.extend({
- defaults:{
- text : ""
- }
- });
- var DirectionsCollection = Backbone.Collection.extend({
- model : DirectionModel,
- initialize : function(){
- this.model.on('destroy', this.change, this);
- },
- })
- var IngModel = Backbone.Model.extend({
- defaults:{
- text : ""
- }
- });
- var IngCollection = Backbone.Collection.extend({
- model : ingModel,
- initialize : function(){
- this.model.on('destroy', this.change, this);
- },
- })
- var RecipeModel = Backbone.Model.extend({
- defaults : {
- name : '',
- desc : '',
- ing : new IngCollection(),
- directions : new IngCollection(),
- },
- initialize : function(){
- console.log(this);
- }
- });
- r = RecipeModel({
- "id" : 1,
- "name" : 'gsr recipe 1',
- "desc" : "some recipe",
- ing : [{"id" : 1, "text" : "1 tsp salt"}, {"id" : 2, "text"}],
- direction : [{"id" : 1, "text" : "Add salt to tast"}, {"id" : 2, "blah blah"}]
- })
Add Comment
Please, Sign In to add comment