[英]materializecss + Angular 6 how to configure?
I am new to Angular in general and I am trying to use materializecss with Angular 6. I am using CLI to create my components.我是 Angular 的新手,我正在尝试在 Angular 6 中使用materializecss 。我正在使用 CLI 创建我的组件。
I have read materials about how to do it in Angular 2, but Angular 6 seems to be different, for instance not having angular-cli.json file.我已经阅读了有关如何在 Angular 2 中执行此操作的材料,但 Angular 6 似乎有所不同,例如没有 angular-cli.json 文件。
How can I get materializecss running in Angular 6?如何在 Angular 6 中运行 materializecss?
Command used to install materializecss: npm i materialize-css@next
用于安装 materializecss 的命令:
npm i materialize-css@next
angular.json attempted modification: angular.json 尝试修改:
"styles": [
"./node_modules/materialize-css/dist/css/materialize.css",
"src/styles.scss"
],
"scripts": [
"./node_modules/jquery/dist/jquery.min.js",
"./node_modules/materialize-css/dist/js/materialize.js"
]
This alone did not work.仅此一项是行不通的。
Have you tried ngx-materialize ?你试过ngx-materialize吗?
their instructions suggests that you also need to alter the tsconfig.json file and add the following to the types array:他们的说明建议您还需要更改 tsconfig.json 文件并将以下内容添加到 types 数组:
unless you are looking for a specific component I would suggest angular-material as a better alternative.除非您正在寻找特定组件,否则我建议使用angular-material作为更好的选择。
There are a few ways of using materialize styles in Angular.在 Angular 中有几种使用实体化样式的方法。
To list some:列出一些:
materialize-angular is also good, but is currently not backed by any organisations and therefore too has many out-of-date dependencies. materialize-angular也不错,但目前没有任何组织支持,因此也有许多过时的依赖项。
If you don't know exactly why you might need an angular specific css framework, consider using the vanilla Materialize or Bootstrap frameworks.如果您不确切知道为什么您可能需要特定于角度的 css 框架,请考虑使用 vanilla Materialize 或 Bootstrap 框架。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.