angular2材料主题不起作用

时间:2017-10-06 06:57:03

标签: angular angular-material2

1)我创建了这个文件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

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

3)哦,亲爱的...我的他妈的没有露出......一个令人讨厌的灰色......

<button mat-button  color="primary" (click)="add()">Add Point!</button>

逻辑将决定颜色应该是浅蓝色......

1 个答案:

答案 0 :(得分:2)

您需要在angular-material-theme中加入主题。在theming.scss文件的末尾执行以下操作:

@include angular-material-theme($theme);