js` and I would like to repeat an array into a list
From this: This is in the Service:
var Response= [
["Article One"],
["Article Two"],
["Article Three"],
["Article Images", ["Images 1", "Images 2", "Images 3"] ],
["Article Five"]
];
And calling the Object from the Controller:
$scope.Response = function () {
return ArtikelSucheService.Response;
};
I want to repeat it like this:
<ul ng-repeat="Article in Response()">
<li>Article One</li>
<li>Article Two</li>
<li>Article Three</li>
<li>Images
<ul ng-repeat="What must stay here?">
<li>Images 1</li>
<li>Images 2</li>
<li>Images 3</li>
</ul>
</li>
<li>Article Five</li>
</ul>
I don't know, how can I repeat an array in an array. Response is an array. And in Response there are x images. 1 article can have many images.
Can anybody help me out?
var Response1= [
["Article One"],
["Article Two"],
["Article Three"],
["Article Images", ["Images 1", "Images 2", "Images 3"] ],
["Article Five"]
];
and in html use below template
<ul>
<li ng-repeat='option in responses1'>
{{option[0]}}
<ul>
<li ng-repeat='suboption in option[1]'>{{suboption}}</li>
</ul>
</li>
</ul>
working fiddle http://jsfiddle.net/jw5Qf/1/
May be like following?
<ul>
<li ng-repeat="Article in Response()">
{{ Article[0] }}
<ul ng-show="Article[1]">
<li ng-repeat="img in Article[1]">{{ img }}</li>
</ul>
</li>
</ul>