angular2 material theming does not work

ぃ、小莉子 提交于 2019-12-11 16:13:14

问题


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) I added this to .angular-cli.json

 "prefix": "app",
  "styles": [
    "theming.scss",
    "styles.css"
  ],

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...


回答1:


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);


来源:https://stackoverflow.com/questions/46599971/angular2-material-theming-does-not-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!