Reputation: 2610
I want to use Angular Material in my MEAN stack app, but I get the following error:
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
In my Angular CLI apps I manage to work with Angular material, but with this app I just can't seem to make it work. It is probably because of the structure of the app:
As you can see on the image I tried with the @import statement. On the homepage I put a checkbox Material item (here named jjjjjj), but as you can see it doesn't have the theme so it doesn't look good.
Upvotes: 1
Views: 4609
Reputation: 2658
I had the same problem, and it was because I was trying to import the material theme into the css file of one of my components. Moving the import statement to the top-level styles.css file worked.
Add the line below to the file src/styles.css
:
@import "@angular/material/prebuilt-themes/indigo-pink.css";
Upvotes: 2
Reputation: 568
I had the same problem and for me it works try to add this line instead:
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
you can choose here the theme you want to apply Material theme
Upvotes: 3