在我的 Angular2 项目中,我安装了来自 https://material.angular.io/guide/getting-started 的最新 Material 插件.接下来,我将 @import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
添加到我的组件的 css 文件中。但是在我的控制台中,Angular 显示了这个错误:
material.es5.js:148 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`
Material 组件不工作。 怎么了?
最佳答案
请将以下代码插入您的 styles.css 中,该文件位于您的 src 文件夹中。
@import "../node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css";
您可以选择prebuilt-themes 文件夹下的任何css。
关于Angular Material 找不到 Angular Material 核心主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44230852/