I have the following sample json:
{
"camp": [
{
"name": "Name",
"data": [
{
"date": "04/08/2014",
"value": 1000
},
{
"date": "05/08/2014",
"value": 1110
}
]
}
]
}
Here, I'm able to do: model.get("camp")[0], but when I try: model.get("camp")[0].get("data"), I get the following error:
undefined is not a function
Here model is the standard backbone model which extends Backbone.Model
I'm confused what I'm doing wrong !!
objin the first place, what exactly doesobj.get()return?obj["camp"][0]["data"]obj.camp[0]orobj.camp[0]['data']model.get("camp")[0], what does it give you? (try a console.log with it). Also, what doesconsole.log(model["camp"]);output for you?