I got a confusion sate now, any one clear my doubt and give more details about http://backbonerelational.org/ please?
basically,
Why we use the relational
When we need to take a decision to use that
Can't we achieve the same with Backone.js itself..?
i have this scenario, i have the sample json like this:
var navi = {
"mainLinkLabel": "Home",
"mainLinkHref": "/home.html",
"sublinks": [
{
"sublinkLabel": "subHome1",
"sublinkHref": "/home/home1.html"
},
{
"sublinkLabel": "subHome2",
"sublinkHref": "/home/home2.html"
},
{
"sublinkLabel": "subHome3",
"sublinkHref": "/home/home3.html"
}
]
}
it has the mainlink and sublinks:
for this I should make the model as like to cover the both info:
var bothModels = Backbone.Model.extend({
defautls:{
"mainLinkLable" : "default Lable",
"mainLinkHref" : "#",
"sublinks" : [
"sublinkLabel" : "default sublink",
"sublinkHref" : "#"
]
}
})
or i need to make separate models for each and connect with Backbone-relational.. like this?
var mainModel = Backbone.Model.extend({
defautls:{
"mainLinkLable" : "default Lable",
"mainLinkHref" : "#"
}
})
var subModel = Backbone.Model.extend({
defaults:{
"sublinkLabel" : "default sublink",
"sublinkHref" : "#"
}
})
if so, how can i connect these both models.. and what would be the benefit will i get. I search across the internet to find some simple tutorial to understand this.. But i couldn't come with some..
any one clarify me this scenario please..?