【发布时间】:2019-06-02 20:54:49
【问题描述】:
我使用材质列表控件来显示嵌套对象。我用 div 创建了 mat 列表,但我想在此处添加展开/折叠行选项,当我单击行时,它应该显示子类别 div ?
<mat-list>
<div *ngFor="let item of chaptersItems">
<mat-list-item>
<a style="cursor: pointer;">
<h4 mat-line>{{item.name}} {{item.description}}</h4>
</a>
</mat-list-item>
<mat-list style="margin-left:30px;">
<div *ngFor="let subItem of item.subChapters">
<mat-list-item>
<a style="cursor: pointer;">
<p mat-line> {{subItem.name}}. {{subItem.description}}</p>
</a>
</mat-list-item>
</div>
</mat-list>
</div>
</mat-list>
如何在 div 或 mat-list 控件上实现点击功能?
【问题讨论】:
标签: angular typescript