Issue with angular material 2 in angular cli

南楼画角 提交于 2019-12-10 20:52:19

问题


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

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