css - 禁用时如何更改Angular 5材质中的样式 - 选择选定文本
问题描述
当设置为禁用时,如何更改显示来自 Angular 5 材料垫选择的选定值的文本上的字体颜色。目前它默认为灰色,我想更改它,以便在禁用和启用时都显示深蓝色。
<mat-form-field>
<mat-select placeholder="Select a Product" [(ngModel)]="selected" [disabled]="isDisabled" panelClass="my-select-panel-class">
<mat-option *ngFor="let prod of products" [value]="prod.productID">
{{ prod.key }}
</mat-option>
</mat-select>
</mat-form-field>
解决方案
了解如何在禁用 mat-select 元素时更改字体颜色。上面的 ngClass 对字体颜色不起作用。它确实适用于字体大小。
The Styling mat-select in angular-material链接的答案最多,除了覆盖禁用字体颜色,您需要覆盖样式 .mat-select-value-text
例如
::ng-deep .mat-select-value-text {
color: rgba(0,0,0,.88);
}
推荐阅读
- azure - Http Trigger Azure函数随机返回404
- python - 在 LSTM tensorflow2.0 中计算给定时间步的输出相对于输入的导数
- twilio - Twilio +将变量传递给函数
- spring-boot - server-deployment.yml 未从 Spring Cloud Data 流服务器中的 server-config.yml 读取值
- javascript - 自定义 Azure DevOps REST API 调用
- heroku - 如何通过 heroku CLI 访问 Heroku 应用程序控制台
- c# - 在c#中使用动态项反序列化json对象
- azure-ad-b2c - Azure B2C 隐式流:在不使用 iFrame 的情况下获取新的访问令牌
- validation - 如何在 vue/element-ui 中验证间隔值
- security - 客户端服务器:如何让客户端更难修改其源代码