Lakshman Pilaka Lakshman Pilaka - 1 year ago 131
AngularJS Question

Aligning cards in ng-repeat

I am showing cards using

. The data and all is coming fine but somehow i am struggling to have 3 cards in a row and go to the next row for the other items.

code is as follows:

<md-content ng-repeat="agent in agents|filter:search" layout="row">
<span class="md-subhead">{{agent.RCustId}}</span>
<span class="md-headline">{{agent.FullName}}</span>
<span class="md-subhead">{{agent.ContactNum}}</span>



<md-card-actions layout="row" layout-align="end center">
<md-button>Collect {{agent.balance_amount}}</md-button>


I want the card side by side but these are coming one per each line.

Where is the issue and how to resolve it please.

Answer Source

Try surrounding md-card with a <div> with layout-wrap - you can then use flex=".." - with number corresponding to number of columns you want in row.

See layout options documentation here.

<div class='md-padding' layout="row" layout-wrap>
       <md-card flex="33" ng-repeat="agent in agents|filter:search">

See answer here for more detail and examples.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download