【发布时间】:2019-03-21 22:13:04
【问题描述】:
我应该如何包含 Angular 外部的库?我想在我的项目中包含 Fontawesome Pro。但我不知道将我的库文件夹放在哪里。
【问题讨论】:
-
不,我想手动外部包含 fontawesome Pro,我在这里解决了fontawesome.com/how-to-use/on-the-web/setup/…
标签: angular font-awesome
我应该如何包含 Angular 外部的库?我想在我的项目中包含 Fontawesome Pro。但我不知道将我的库文件夹放在哪里。
【问题讨论】:
标签: angular font-awesome
你可以使用 npm 包,
npm install --save font-awesome angular-font-awesome
导入你的根模块,
import { AngularFontAwesomeModule } from 'angular-font-awesome';
@NgModule({
imports: [
AngularFontAwesomeModule
]
})
export class AppModule { }
如果您使用的是 Angular CLI,则需要将其添加到您的 angular-cli.json,如其他答案所示。
"styles": [
"../node_modules/font-awesome/css/font-awesome.css"
]
文档是here,
【讨论】:
您必须使用 npm 安装它,例如 npm i font-awesome --save
并在 angular.json 文件中添加样式路径
"styles":[
"./node_modules/font-awesome/css/font-awesome.min.css",
]
【讨论】:
我想手动添加。我相信在 Angular 的资产中可以做到这一点,但是,因为我需要 fontawesome Pro,所以我在这里得到了它:https://fontawesome.com/how-to-use/on-the-web/setup/using-package-managers? fbclid = IwAR3ef_gIvsQsb7Kv0TIkAIJPxo-LAaltKMcsaiICpHfHXMOlPdijBSUnKDc
【讨论】: