angular - 角度材料中的嵌套列表
解决方案
正如评论中@Vega所指出的,您不能在 a<mat-list>
下嵌套 a <mat-list-item>
,但是如果您 ngFor 另一个包含它们的 div ,它仍然可以,并且<mat-list>
行高是正确的。
这是@Vega的一个示例:https ://stackblitz.com/edit/angular-nnkg3h-xppmzz
<mat-list>
<ng-container *ngFor="let item of items">
<mat-list-item>{{item.name}}</mat-list-item>
<mat-list style="margin-left:30px;">
<div *ngFor="let subItem of item.subItems">
<mat-list-item>{{ subItem.name }}</mat-list-item>
</div>
</mat-list>
</ng-container>
</mat-list>
推荐阅读
- laravel - 如何将 laravel 路由中的 post 参数传递给 vue js 中的 axios?
- powershell - 从数组中调用项目并运行 foreach
- android - Android 上同时支持 BLE 和 HFP/A2DP 的智能手机芯片组的差异
- c - 在同一个 DPDK lcore 上运行多个线程
- apache-kafka - Kafka 提交:生产者与消费者
- ag-grid - Ag Grid v25.3.0 问题 - 当网格为空时,新数据似乎没有更新网格
- ios - Apple 付款通知 - 如何从通知中获取最新的pending_renewal_info?
- python - 使用 Python Pandas 删除 CSV 中标题上方的行
- .net - .NET Core 在多个地方更改日期格式
- html - 是否可以将打印样式规则应用于屏幕上的元素?