So I have an API that returns a list of activities,but I have to get the info 2 items at a time so if I have 3 items on the first call the json returned would be something like this:
cesta{
fecha="14/08/2015 2:42:28 PM",
tipo="9",
pagina="1",
total="3",
inst [{
nu_doc_opened="N",
nu_doc="14",
nu_inst="1",
nb_wf{
cdata_section="Gestión calendario específico"
}
},
nu_doc_opened="N",
nu_doc="15",
nu_inst="2",
nb_wf{
cdata_section="Gestión calendario general"
}
}]
}
and on the next call the json returned would be like this
cesta{
fecha="14/08/2015 2:42:29 PM",
tipo="9",
pagina="2",
total="3",
inst {
nu_doc_opened="N",
nu_doc="16",
nu_inst="1",
nb_wf{
cdata_section="Gestión calendario específico"
}
}
}
I want to go throgh this json and get some of the data and put it in a table,so I'm trying to use ng-repeat like this: (Note that I only want to get some of the values not all)
$scope.basket= data.cesta.inst;
<tbody>
<tr ng-repeat="b in basket">
<td>{{b.nu_doc}}</td>
<td>{{b.nu_inst}}</td>
<td>{{b.nb_wf.cdata_section}}</td>
</tr>
</tbody>
The problem is that this works when the json has 2 or more objects in 'inst' (like in the first example) because it's an array, but when it has only 1 object won't work, What could I do so the ng-repeat work in both cases? Thanks in advanced