Change angular material progress bar color from code

后端 未结 4 1242
后悔当初
后悔当初 2020-12-17 19:43

I need to change the color of angular material progress bar dynamically. I realized that it is not that simple, so what is the best way to to it?

requirements:

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-17 20:20

    Update:

    Avoid using deep, TL;DR: Deep is technically invalid (like, deeprecated :p)

    For more info refer: The use of /deep/ and >>> in Angular 2

    Now, to change the color of mat-progress bar,

    Head over to your styles.scss file (or the main css/scss file in your project)

    Add this class -->

    .green-progress .mat-progress-bar-fill::after {
        background-color: green !important;
    }
    

    Your mat-progress should use the above class, like -->

    
    

提交回复
热议问题