Angular 2 Material cannot load style

I am starting to develop a web application in Angular using the Angular material library for the interface. But I get an error when trying to import a pre-created topic. To import it, I added <link rel="stylesheet" href="../node_modules/@angular/material/prebuilt-themes/indigo-pink.css">to my index.htmlfile, but when I started ng serve, I can not get the file.

+6
source share
2 answers

If you use angular-cli, follow their steps to enable Angular-Material .

Make sure you have the import below: src/styles.css

@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
@import '~https://fonts.googleapis.com/icon?family=Material+Icons';

, angular-material Getting Started, .

+3

. , :

 <link rel="stylesheet" href="lib/@angular/material/core/theming/prebuilt/indigo-pink.css">
+1

Source: https://habr.com/ru/post/1017031/


All Articles