单击角形按钮后如何更改按钮的颜色 [英] how to change color of button after clicking button in angular
本文介绍了单击角形按钮后如何更改按钮的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
点击按钮后,我需要将按钮颜色更改为红色(从原色更改为红色),请帮助我如何在点击按钮后更改颜色.
i need to change button color into red (primary color to red color) after clicking button, please help me how to change color after clicking button.
<td>
<button mat-icon-button color="primary">
<mat-icon>remove_circle</mat-icon>
</button>
</td>
推荐答案
在您的代码中实现此逻辑.
Implement this logic in your code.
var isClicked = false;
.myClass{
color : red;
}
<td>
<button mat-icon-button color="primary" (click)="isClicked = !isClicked" [class.myClass]="isClicked">
<mat-icon>remove_circle</mat-icon>
</button>
</td>
这篇关于单击角形按钮后如何更改按钮的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文