没有选择框的材料选择列表,但列表元素突出显示-寻找示例

问题描述 投票:0回答:1

我找到了材料选择列表的示例:

https://stackblitz.com/edit/material-selection-list-5-0-0-qhyxd5?file=app%2Fapp.component.html

非常好,但是当选择一个或多个行时,我需要进行突出显示。首先,我需要隐藏复选框,其次需要设置所选行的背景样式。有人知道如何,对示例有知识或可以指导我回答吗?

angular typescript list selection material
1个回答
0
投票

您可以使用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
}
© www.soinside.com 2019 - 2024. All rights reserved.