【发布时间】:2019-05-20 21:26:32
【问题描述】:
如何在 ngFor 中将数组拆分为四项?
如何在此处显示 4 个项目而不是一个?
<div *ngFor="let item of items$ | async">
// How can I show here 4 projects instead of one?
{{item}}
</div>
【问题讨论】:
-
不清楚您的要求。
How can I show here 4 projects instead of one???? -
至少向我们展示你的 JSON
-
我认为那里有很多适合您的答案,但需要有关您的架构和您想要实现的目标的更多信息。 @stingingdafunk 有最优雅的答案,但可能值得查看我的答案和其他答案并了解它们的工作原理,以便您对 *ngFor、管道和组件中的数据操作有更广泛的了解。
标签: arrays angular typescript ngfor