This is my data model (a survey):
{
"name" : "x",
"questions" : [ .... ]
}
This is my viewModel:
survey : ko.observable(undefined)
This is my data-bind tag:
<ol data-bind="foreach: data.survey.questions">
It doesn't work. It works if I change the binding like this:
<ol data-bind="foreach: data.survey().questions">
The problem is that inside the foreach binding there's another foreach looping through the possible answers to the questions:
<div data-bind="foreach: answers">
I didn't find any way to make this one work with my current setup. Basically I think the problem is that you need to use an observableArray
but I want to loop on an array inside an observable instead.
Can anyone suggest a way to make this double foreach work? Thanks!