angular2 材质主题不起作用 [英] angular2 material theming does not work
本文介绍了angular2 材质主题不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
1) 我创建了这个文件 src/theming.scss
1) I created this file src/theming.scss
@import '~@angular/material/theming';
@include mat-core();
$primary: mat-palette($mat-light-blue);
$accent: mat-palette($mat-amber , 700, A100, A400);
$theme: mat-light-theme($primary, $accent)
2) 我将此添加到 .angular-cli.json
2) I added this to .angular-cli.json
"prefix": "app",
"styles": [
"theming.scss",
"styles.css"
],
3) 哦,天哪...我的 themimg 没有显示...它是一个令人讨厌的灰色...
3) Oh dear...my themimg is not showing..its a a yucky gray...
<button mat-button color="primary" (click)="add()">Add Point!</button>
逻辑会规定颜色应该是浅蓝色...
Logic would dictate that the color should be light blue...
推荐答案
您需要在 angular-material-theme
中包含您的主题.在 theming.scss
文件末尾执行以下操作:
You need to include your theme in angular-material-theme
. Do the following at the end of your theming.scss
file:
@include angular-material-theme($theme);
这篇关于angular2 材质主题不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文