如果元素在Angular 范围内被触摸/聚焦/激活,如何更改材料表单域的边框颜色。我试过change color by overriding材质的css类,也试过创建我自己的css类,但这两种方式都不影响元素。
/*my.component.html*/
<mat-form-field class="matFormField">
<mat-label>Name</mat-label>
<input matInput [formControl]="name" required>
</mat-form-field>
/*my.component.css*/
.matFormField:focus {
border-color: green !important;
color: green;
}
1条答案
按热度按时间dldeef671#
如果我理解正确的话,你可以试着用“内观”。下面是一个应用你的代码的html示例。
如果我误解了,请让我知道,这样我就可以研究另一种方法。