为什么我的列显示在彼此下方而不是下一个?
Why are my columns appearing below each other instead of next?
正如您从图片底部看到的那样,我的产品出现在彼此下方。我该如何使它们在自己的列中彼此相邻出现?
View image
<tr>
<th>Month</th>
<div *ngFor="let p of products">
<th><b>{{ p.productLabel }}</b></th>
</div>
您正在遍历 div
,这是一个 block
类型的 HTML 标签。
将 *ngFor
放在 th
上。
正如您从图片底部看到的那样,我的产品出现在彼此下方。我该如何使它们在自己的列中彼此相邻出现? View image
<tr>
<th>Month</th>
<div *ngFor="let p of products">
<th><b>{{ p.productLabel }}</b></th>
</div>
您正在遍历 div
,这是一个 block
类型的 HTML 标签。
将 *ngFor
放在 th
上。