Change default background color of md-slider of Angular Material

后端 未结 7 627
野的像风
野的像风 2021-02-04 20:06

I am using md-slider of Angular Material version 2.0.0-beta.8

I have selected the indigo-pink theme and imported it in

7条回答
  •  伪装坚强ぢ
    2021-02-04 20:44

    ::ng-deep is the way to override theme classes, as stated by Nehal.

    It seems though that it does not work if you concatenate more classes. In other words the following code does NOT work

    ::ng-deep .mat-accent .mat-slider-thumb, .mat-accent .mat-slider-thumb-label, .mat-accent .mat-slider-track-fill {
        background-color: black;
    }
    

    while the following version of the code actually works and overrides effectively the values set in the theme css

    ::ng-deep .mat-accent .mat-slider-thumb {
        background-color: black;
    } 
    ::ng-deep .mat-accent .mat-slider-thumb-label {
        background-color: black;
    } 
    ::ng-deep .mat-accent .mat-slider-track-fill {
        background-color: black;
    } 
    

提交回复
热议问题