I would like to have the following. Imagine that you have homework that has several problems and a class. Each problem consists of several parts and difficulty level. Each part has a right or wrong attribute.
I would like to implement this logic through nested models (or, indeed, you can do it, this is just my best guess). Thus, there would be a model “part” that has the right or wrong attribute. Then there will be a model, called a problem, which is connected with it in several parts (the collection is "not sure if this is possible") and the complexity of the attribute. Then you will have the homework of the model, which is associated with several problems associated with it, and an attribute class.
My question is:
Is it possible? If so, what is the syntax for creating your general model? What is the syntax for this?
I am looking for something in common:
var Homework=Backbone.model.extend({
defaults:{
grade:100,
parts: var parts=Backbone.model.extend({ ....
},
});
var Homeworkview=Backbone.view.extend({
initialize: function(){
},
render: function(){
});
So how do you do this?
source
share