User User - 29 days ago 19
AngularJS Question

Is it possible to change the color of disabled active mdSwitch of Angular material?

I am using Angular Material md-switch. In documentation it is showing some different color when the switch is enabled. But I need a functionality like changing the color of switch when it is in Disabled Active. Please help me in acheving this. Thanks in advance.



<md-switch aria-label="Switch 11" ng-class="{'md-checked':database.somevalue.value['alarm']}"
ng-disabled="true"> Alarm
</md-switch>




Answer

Here you go - CodePen

enter image description here

CSS

md-switch[disabled]#blah .md-container > div
{
  cursor: default;
  background: lightgreen;
}

md-switch[disabled]#blah .md-container > div > div
{
  background: green;
}
Comments