hallPlace: string[] = [];
// I initialize array default data here
for(let i=0; i<160; i++) {
if(i%5===0) {
this.hallPlace[i] = 1
} else {
this.hallPlace[i] = 0;
}
}
我想在一排显示20个元素
<ul>
<li *ngFor="let place of hallPlace; let i = index">
<span>{{place[i]}}</span>
<br *ngIf="i%20 ===0" >
</li>
</ul>
但是它只显示其余元素的数组中的第一个元素。由于容器包含行和列,是否有更好的显示数据的方法?
答案 0 :(得分:1)
您可以尝试遍历二维数组,例如
val select = (for {
thing1 <- query1
thing2 <- query2
thing3 <- query3
listToCount <- query4 selecting everything I wanted to count
} yield (thing2, thing3, listToCount))
.groupBy({
case (thing2, thing3, listToCount) =>
(thing2, thing3)
})
.map({
case ((thing2, thing3), list) =>
(thing2.deliveryDate, thing3.schedulerJobId, list.map(_._3).length)
})