Hi everybody,
Similar to the topic I have posted here, I got some problem when I try to bind objects from the component to its viewModel.
Here is the example: JSBIN
When working with nested object and I try to bind it to a DOM element attribute (for instance the value of an input tag), I find I cannot bind it’s attributes directly but only using a computed prop declared in the viewModel. It is correct ?
So,
Having this:
var HomeViewModel = can.DefineMap.extend({
"mainItem":{
value:{
"objList":[ {"listed": "item 1"},
{"listed": "item 2"} ]
}
},
"index":{
value:0
}
});
This will not work:
<input type="text" value="{{mainItem.objList[index].listed}}" />
I cannot figure out why, instead, using this strange “static notation” will work.
<input type="text" value="{{mainItem.objList.0.listed}}" />
Thank for helping!