在父div中使用*ngFor
单次
<div>
<h2 class="ylet-primary-500 alignleft">Sessions</h2>
<p class="alignright"><mat-icon class="ylet-primary-500">add_circle_outline</mat-icon></p>
</div>
<div style="clear: both;"></div>
<div *ngFor="let batch of batches">
<div>
<h3 class="classes" >{{batch.month}}
<span class="chips">
</span>
</h3>
<p class="ylet-primary-500 booking"><a>Book now</a></p>
</div>
<div style="clear: both;">
<p class="timings">
<mat-icon matPrefix>access_time</mat-icon><span >{{batch.time}}</span>
<span class="slots" > <mat-icon>list_alt</mat-icon>{{batch.slots}}</span>
</p>
</div>
</div>
而不是创建三个ngFor
循环来显示每个属性,使用一个ngFor
但在父元素上。 Something like this。