对不起标题,这是我的第一篇文章。
好的,我的问题是,我有这个JSON:
{
"nodes" : [
{
"node" : {
"Title" : "this is a title",
"slideshowImage" : [
{
"src" : "imagen.png",
"alt" : ""
},
{
"src" : "imagen.png",
"alt" : ""
},
{
"src" : "imagen.png",
"alt" : ""
},
{
"src" : "imagen.png",
"alt" : ""
}
],
"Thumbnail" : {
"src" : "imagen.png",
"alt" : ""
},
"id" : "28"
}
}
]
}
如何获得ng-repeat
到slideshowImage
例如:ng-repeat="node in items.slideshowImage"
{{node.node.slideshowImage.src}}
我做错了吗?
答案 0 :(得分:2)
确保您的对象已分配给nodes
对象,然后就像下面一样简单。
ng-repeat="image in nodes.node.slideshowImage"
答案 1 :(得分:1)
如果你想在视图中重复直接喜欢以下: -
<div ng-repeat="N1 in sampleData.nodes">
<div ng-repeat="N2 in N1.node.slideshowImage">
{{N2.src}}
</div>
</div> <!-- Looped down to Subnodes For your Understanding --!>
或者只是将其保存到范围内快速方式: -
$scope.quickData=$scope.sampleData.nodes[0].node.slideshowImage; // as per data length
现在滚动(ng-repeat): -
<div ng-repeat="quick in quickData">
{{quick.src}}
</div>
https://plnkr.co/edit/EhuLmjzNa5srX2AV2gqT?p=preview
两个结果都保存在Plunker
中快乐学习!!
答案 2 :(得分:0)
你应该做
ng-repeat="item in nodes.node.slideshowImage"
并在您的观看中
{{ item.src }}