【发布时间】:2018-10-16 11:50:35
【问题描述】:
找不到有效的答案。
简单的 *ngFor 返回一个数组:
<ul class="address>
<li *ngFor="let address of census">
{{address.occupants}}
</li>
</ul>
看起来很简单,但结果看起来像:
John Smith,John Doe,John Brown
请注意结果之间没有间距。
这是因为“occupants”是我数据中的一个数组:
{
id: 1,
occupants: ['John Smith', 'John Doe', 'John Brown'],
address: '5 Johns Street',
},
如何使用 *ngFor 输出 Johns 列表,每个条目之间有一个空格?
【问题讨论】: