user3224207
user3224207

Reputation: 437

ng-repeat multiple times in Angularjs

I have this 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"
        ]
}

I have to print title and its related images under that title on an HTML page.

I'm doing this:

<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>

I found this solution on another Stack overflow question. But it is not printing anything but 0 1 2 3 0 1 2 3

Can somebody please figure out where the problem might be. Thanks.

Upvotes: 2

Views: 174

Answers (1)

kukkuz
kukkuz

Reputation: 42352

maybe you should try:

<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>

Upvotes: 1

Related Questions