在Angularjs中多次重复ng-repeat

时间:2016-07-26 04:27:02

标签: javascript angularjs arrays image angularjs-ng-repeat

我有这个JSON

{
    "Industrial Visits to L&T Construction Equipment Limited":
        [
            "1467970539_789007_2014.jpg",
            "1467970539_644015.jpg",
            "1467970539_238317.png",
            "1467970539_946963.png"
        ],
    "Industrial Visits to Titan":
        [
            "1467968484_995138.png",
            "1467968226_987063.jpg",
            "1467968226_210302.jpg",
            "1467969523_721853.jpg"
        ]
}

我必须在HTML页面上打印标题及其相关图像。

我这样做:

<div ng-repeat="item in indusvisitlist">
                    <div ng-repeat="(key, value) in item">
                        <h3>{{key}}</h3>
                        <p class="col-md-6 col-sm-6" ng-repeat="image in value">
                            <img src="files/{{image}}" class="img-responsive img-thumbnail" />
                        </p>
                    </div>
                </div>

我在另一个Stack溢出问题上找到了这个解决方案。但它不打印任何东西 0 1 2 3 0 1 2 3

有人可以找出问题所在。感谢。

1 个答案:

答案 0 :(得分:1)

也许你应该尝试:

<div ng-repeat="(key, value) in indusvisitlist">
   <h3>{{key}}</h3>
   <p class="col-md-6 col-sm-6" ng-repeat="image in value">
     <img ng-src="files/{{image}}" class="img-responsive img-thumbnail" />
   </p>
</div>