标签: angular angular-material
下面是仅发生扩展的示例,但是我希望在单击该行时将其折叠。
https://stackblitz.com/edit/angular-material-expandable-table-rows?file=app%2Ftable%2Ftable.component.ts
我希望我的桌子像这样:
请帮助。
答案 0 :(得分:3)
替换 (click)="expandedElement = row"
(click)="expandedElement = row"
使用
(click)="expandedElement === row? expandedElement = null : expandedElement = row"
https://stackblitz.com/edit/angular-material-expandable-table-rows-8ypyfu?file=app%2Ftable%2Ftable.component.html