ng-repeat for array of images

2

I have a function that calls the element 'categories' of the BD. This 'Categories' table has a field called 'gallery' which is an array of images. I want to do a ng-repeat that shows me the images of this field. the code that I have, but that does not work, is this:

<div class="col-md-3"
          ng-repeat="c in Categorias">
          <div class="img">
              <img ng-src="{{asset('img/galeria/[[c.galeria]')}}" alt="">
          </div>
          </div>

    
asked by Ronel Jimenez 31.07.2017 в 21:46
source

2 answers

1

You're visiting Categories , this one contains an array of objects called Gallery and this, objects with the property img , go through it like this:

<div class="col-md-3" ng-repeat="c in Categorias">
  <div class="img" ng-repeat="galeria in c.galeria">
   <img ng-src="{{galeria.img}}">
 </div>
</div>
    
answered by 31.07.2017 / 21:59
source
0

If I do not understand, you are iterating the array Categories but your images are in the array Gallery

Verify if you are going through the correct array and if the values are arriving to you as you have it (you can do it by means of HTML tags

<div class="col-md-3" ng-repeat="c in Categorias">
 <div class="img">
  <p>{{c.galeria}} </p>
 </div>
</div>
    
answered by 31.07.2017 в 21:55