我找到了材料选择列表的示例:
https://stackblitz.com/edit/material-selection-list-5-0-0-qhyxd5?file=app%2Fapp.component.html
非常好,但是当选择一个或多个行时,我需要进行突出显示。首先,我需要隐藏复选框,其次需要设置所选行的背景样式。有人知道如何,对示例有知识或可以指导我回答吗?
您可以使用ngClass
作为选项列表:
HTML:
[ngClass]="{'special-class': selectedOptions.includes(filter.value) }"
CSS:
.special-class{
background-color: red; -- to set the background color
pointer-events: none; -- to disable user clicks
}