Angular 5 实现 css

Angular 5 with materialize css

我正在学习 angular 5。但我正在按照本教程将 materialize css 模块导入我的应用程序。 Ang with angular2materialize 然后我 运行 ng serve 编译成功。但是当我加载内容时 return 出现错误

Uncaught Error: Couldn't find Materialize object on window. It is created by the materialize-css library. Please import materialize-css before importing angular2-materialize.

我该如何进行?

<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css">

<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/js/materialize.min.js"></script>

您可以通过下载或使用 CDN 以两种方式使用 Materialize css。添加这些行在你 app.component.html。这些是 CDN 的链接。其他版本的 CDN https://cdnjs.com/libraries/materialize

在app.module.ts.

import {MaterializeModule} from 'angular2-materialize';之前使用import 'materialize-css';