0

I'm doing a image grid view galery. I'm using for that ng-repeat and CSS. My code looks like:

<div class="grid-container" style="display:block;">
<ul class="rig columns-3" ng-repeat="element in elementsList track by $index">
    <li>
         <img ng-src='{{src_url}}' ng-click="routeTo('/')"/>            
    </li>                  
</ul>
</div>

Now I have css for changeit to a grid with 3 columns. The problem is when I do statically 3x <li> the css works great and I have 3 images in a row. But when I'm loading it with ng-repeat I have only 1 image per row. It seems that css is applied before ng-repeat list is and somehow it doesn't make the grid for my images.

What should I do to make it right?

1
  • please share css and controller code as well Commented Apr 18, 2018 at 15:20

1 Answer 1

1

In this snippet, you're actually repeating <ul> three times, not <li>.

Move ng-repeat to <li>, something like:

<ul class="rig columns-3">
    <li ng-repeat="element in elementsList track by $index">
         <img ng-src='{{src_url}}' ng-click="routeTo('/')"/>            
    </li>                  
</ul>

(also, are you sure you need {{src_url}} and not {{element.src_url}}?)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.