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屋!
查看全文