I am currently using Angular 9.1.8 for my project.
For my Angular component, I have implemented Bootstrap Card Groups and Cards to display a large result set of cards in rows with more than two cards per row. Below are four example cards:
<div class="container">
<div class="card-group">
<!-- card 1 -->
<div class="card bg-light text-dark">
<img class="card-img-top" src="../../assets/trucking_placeholder2.png" alt="Card image">
<div class="card-body">
<div class="row">
<div class="col">
<h6 class="card-title"> <i class="fas fa-circle text-success"></i> ABC Truck Repair</h6>
</div>
<div class="col">
<div class="float-right"&g;$75/hr | 2.6 miles</div>
</div>
</div>
</div>
<p class="card-text">123 Main Street Idaho Falls, ID 83401</p>
<a href="#" class="card-link"><i class="fas fa-phone-alt"> 208-970-9341</i></a>
</div>
...
While trying to achieve this layout, I tried using the *ngFor directive as shown below:
<div class="container">
<div class="card-group">
<!-- card 1 -->
<div *ngFor="let s of shops;" class="card bg-light text-dark">
<img class="card-img-top" src="../../assets/trucking_placeholder2.png" alt="Card image">
<div class="card-body">
<div class="row">
<div class="col">
<h6 class="card-title"><i class="fas fa-circle text-success"></i> {{s.name}}</h6>
</div>
<div class="col">
<div class="float-right">${{s.laborRate}}/hr | 2.6 miles</div>
</div>
</div>
</div>
<p class="card-text">{{s.address}}<lt/p>
<a href="#" class="card-link"><i class="fas fa-phone-alt"> {italic}{{s.phone}}</i></a>
</div>
...
However, I found that this approach did not limit each group to only two cards as desired.
If you know how to achieve displaying only two cards per group using Angular directives, or if there is a better method to accomplish this, please let me know!