Reputation: 1155
I'm starting to develop an web app in Angular using the Angular Material library for the interface. But I'm getting an error when trying to import a prebuilt theme. In order to import it, I added <link rel="stylesheet" href="../node_modules/@angular/material/prebuilt-themes/indigo-pink.css">
to my index.html
file but when i run ng serve
I cannot get the file.
Upvotes: 10
Views: 10377
Reputation: 810
If you don't find any solution just add angular material again. It won't affect your code but add the CSS. Don't forget to re-start the angular server.
ng add @angular/material
Upvotes: 0
Reputation: 3099
If you are using angular-cli
follow their steps for including Angular-Material.
Ensure you have the below imports in src/styles.css
@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
@import '~https://fonts.googleapis.com/icon?family=Material+Icons';
It's slightly different to what angular-material
suggest on their own Getting Started site but it worked for me.
Upvotes: 13
Reputation: 1079
Check that your path is correct. I had the same problem and I fixed the path: Mine is
<link rel="stylesheet" href="lib/@angular/material/core/theming/prebuilt/indigo-pink.css">
Upvotes: 2