问题
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