javascript - 应用程序无法加载 Angular Material 主题

标签 javascript css angular

我想在我的 MEAN 堆栈应用程序中使用 Angular Material,但出现以下错误:

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

在我的 Angular CLI 应用程序中,我设法使用 Angular Material ,但对于这个应用程序,我似乎无法让它工作。这可能是因为应用程序的结构:

enter image description here

正如您在图像上看到的那样,我尝试使用@import 语句。在主页上我放了一个复选框 Material item(这里命名为 jjjjjj),但是你可以看到它没有主题所以看起来不太好。

enter image description here

最佳答案

我有同样的问题,对我来说它可以尝试添加这一行:

@import "~@angular/material/prebuilt-themes/indigo-pink.css";

您可以在这里选择您想要应用的主题 Material theme

关于javascript - 应用程序无法加载 Angular Material 主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49301639/

相关文章:

javascript - 是否可以从 JavaScript 中的嵌套处理程序方法访问类方法?

div 中第 8 个和第一个元素的 CSS 规则

html - 视口(viewport)边框

Angular 。有没有办法在初始渲染时跳过输入动画?

javascript - 在元素加载后立即运行一些 JS 的最佳方式?

javascript - 滚动后更改对象颜色

javascript - jQuery访问输入隐藏值

css - 我可以将 CSS 应用于一个特定的 Ember.js 模板/路由吗

javascript - 为什么 ViewChild ElementRef 在 ngAfterViewInit 中的宽度和高度为 0?

Angular 2 - 一个根组件的条件子组件