如何在角度中包含材质图标库? [英] How to include material icon library in angular?
问题描述
(我参考此链接 https://github.com/angular/angular-cli/issues/2662),我在 angular.json 中添加 CSS 并导入库 instyle.css(它给出了类似 ./src/styles.css (./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./src/styles.css)),在本地项目中以angular安装材质图标库的正确方法是什么?
(i refer this link for that https://github.com/angular/angular-cli/issues/2662), I add CSS in angular.json and import library instyle.css (it gives an error like ./src/styles.css (./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./src/styles.css)), what is the proper way to install material icon library in the local project in angular?
npm install material-design-icons-iconfont --save
angular.json
angular.json
"styles": [
"src/styles.css",
"../node_modules/material-design-icons/iconfont/material-icons.css",
],
style.css
@import "~material-design-icons-iconfont/dist/material-design-icons";
index.html
<link href="../material-design-icons-iconfont/dist/fonts/" rel="stylesheet">
推荐答案
使用此链接解决了我的问题(https://www.npmjs.com/package/material-icons)
using this link resolved my problem(https://www.npmjs.com/package/material-icons)
npm i material-icons
styles.css
@import '~material-icons/iconfont/material-icons.css';
这篇关于如何在角度中包含材质图标库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!