在选择时更改标签文字颜色

问题描述:

我正在使用Angular4,并且一直在使用角度材料.我已经创建了一个标签组,并且在选择任何标签时都想更改标签标签的文本颜色.我试图覆盖默认的CSS,但这对我没有帮助.

I am working on Angular4 and have been using angular material. I have created a tab-group and I want to change the text color of a tab label when I select any tab. I have tried to override the default css but that didn't help me.

我可以覆盖墨水栏,但是选择时不能覆盖标签文本颜色

I can override the ink bar but I am not able to override tab-text color upon selection

.mat-ink-bar{
    background-color:#00ADEE;
}
 /*.mat-tab-label::selection{
 color: #00ADEE !important;
 } */

我试图更改tab-label-color的颜色的注释部分.

The commented part which I was trying to change the color of a tab-label-color.

您需要对活动标签使用以下类:

You need to use the following class for active tab:

.mat-tab-label-active {
     color: #00ADEE !important;
 } 

这里是工作演示