How to change background color of specific angular material tabs?

后端 未结 2 986
一生所求
一生所求 2020-12-20 06:30

I have a component using mat tab from angular material 7.

I want to change the background color of my tabs depending on a boolean value of my typescript variable.

2条回答
  •  渐次进展
    2020-12-20 07:24

    You might not want to set encapsulation: ViewEncapsulation.None, this will make the styling for this component be applied to all other components too.

    Instead you can set the color for the tab in your styles.scss like this:

    .mat-tab-header{
        background-color: #424242;
    }
    

提交回复
热议问题