我需要像下面的例子一样显示
但是当我添加 ngfor 时,它会将 mat line flex 行中断到列中。
HTML
<mat-list *ngFor="let list of lists">
<mat-list-item *ngFor="let car of list.cars | keyvalue">
<h3 mat-line> {{car.key}} </h3>
<p mat-line *ngFor="let year of car.value">
<span> {{year}} </span>
</p>
<button mat-icon-button >
<mat-icon class="mat-24">delete</mat-icon>
</button>
</mat-list-item>
</mat-list>
TS
export class ListSelectionExample {
lists = [
{
"cars":
{
"12345": [1960, 1961],
"4567": [2001, 2002]
}
}
]}
工作示例代码在这里 Slackblitz.example