Answer the question
In order to leave comments, you need to log in
Question on a simple example from the backbone documentation?
There are two methods in the primary model:
initialize: function() {
if(!this.get("title")) {
this.set({"title":this.defaults.title});
}
},
toggle: function() {
this.save({done: !this.get("done")});
},
Answer the question
In order to leave comments, you need to log in
In the first case, there is also no need: it will this.set({title:this.defaults.title});
work fine.
Read some basic JS syntax book.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question