angular-material - 无法更改垫旋转器的颜色
问题描述
我知道有人问过这个问题(更改 mat-spinner 的颜色),但我想知道是否有不使用已弃用的 ::ng-deep 的解决方案?
此外,我还尝试了链接中建议的方法,但不起作用:
HTML
<mat-progress-spinner *ngIf="pending" mode="indeterminate" class="mat-spinner-color"></mat-progress-spinner>
SCSS
.mat-spinner-color::ng-deep circle{
stroke: #FFFFFF !important;
}
提前致谢!
解决方案
::ng-deep 没有被正式弃用,并且取决于浏览器是否删除了对它的支持,per angular.io
,until then
意味着浏览器正式弃用它,it should be preferred
以实现更广泛的兼容性。/deep/
>>>
因此,我们计划放弃对 Angular 的支持(对 /deep/、>>> 和 ::ng-deep 的所有 3 个)。在此之前 ::ng-deep 应该是首选,以便与工具更广泛地兼容。
https://angular.io/guide/component-styles#deprecated-deep--and-ng-deep
如果您的偏好是避免 ::ng-deep ,则需要将您的修改应用于项目mat-spinner
的根目录styles.css
在styles.css
.orange-spinner circle{
stroke:orange !important;
}
添加类
<mat-spinner class="orange-spinner"></mat-spinner>
堆栈闪电战
https://stackblitz.com/edit/angular-czd4zq?embed=1&file=styles.css
请注意:
根据UmutEsen
下面的评论,正确的解决方案是设置主题并color
利用mat-spinner
.
推荐阅读
- angular - Autodesk + Angular:找不到名称 Autodesk
- c# - 如何在C#中获取datagridview列的总和
- python - 显示 Pandas 数据框的所有行和列
- ios - 我可以在移动浏览器中使用什么来代替 beforeunload?
- java - Docker Container 上的 Java Runtime Exec 的问题
- swift - 以编程方式使用约束 Swift 移动按钮
- reactjs - 如果条件为真,Jest.js 如何测试返回 JSX 的方法是否已呈现?
- javascript - Google 跟踪代码管理器:返回被跟踪链接/元素在 DOM 中的位置,{{Click Element}} 变量
- html - 我尝试使用最大宽度制作响应式网络,但我卡住了,请帮助我
- amazon-web-services - Docker 在 AWS Elastic Beanstalk 中失败