问题
I am trying to add angular material2 to my project. (I use angular-cli)
However, I get the following error when I run ng serve
:
material.es5.js:177 Could not find Angular Material core theme. Most Material components may not work as expected. For more info refer to the theming guide: https://material.angular.io/guide/theming
Although I added it to my global style file.
@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
How can I fix it? Thank you.
回答1:
in your angular-cli.json
under :
"apps": [
//....
"styles": [
//... ,
"../node_modules/@angular/material/prebuilt-themes/indigo-pink.css" //<--add this
],
]
来源:https://stackoverflow.com/questions/44153890/issue-with-angular-material-2-in-angular-cli