How can I customize my button-toggle when it is checked? The current code I have doesn't seem to be working...
This is the code snippet:
<mat-button-toggle-group #mytoggle (change)="selectoption($event)" value="{{num}}">
<mat-button-toggle [style.background-color]="getColor(op)" *ngFor="let op of mylist" [value]="op">{{op}}</mat-button-toggle>
</mat-button-toggle-group>
This is the method in my .ts file:
getColorChecked(opcao: any){
if ( opcao === 2){
return '#EA0B28 !important;';
}else{
return '#9d9b9a !important;';
}
}
And here is the scss styling:
.mat-button-toggle-group, .mat-button-toggle-standalone{
box-shadow: 0 3px 1px -2px rgba(0,0,0,.02), 0 2px 2px 0 rgba(0,0,0,.01), 0 1px 5px 0 rgba(0,0,0,.12);
}
.mat-button-toggle{
border-right: 1px solid #cccccc40 !important;
font-weight: 400;
width: 50px !important;
padding: 0px !important;
background: #f7f9fbc7 !important;
div{
padding: 0px !important;
}
}
.mat-button-toggle-checked {
color: #fbfbfb;
}
The customization is not applying properly. Any suggestions on a better approach?