简体   繁体   English

如何在我的Angular-Cli应用程序中包含JavaScript模块

[英]How do I include JavaScript Modules into my Angular-Cli App

I have downloaded the open source library QuillJS as a stand alone project. 我已经下载了开源库QuillJS作为一个独立的项目。 I have added that folder containing Quill into my Angular Cli app. 我已将包含Quill的文件夹添加到Angular Cli应用程序中。 Based on the Quill Docs, I believe I need to include Quill.js in my scripts for Angular Cli to be able to use the library. 基于Quill Docs,我相信我需要在脚本中包含Quill.js才能使Angular Cli能够使用该库。

However, Quill uses JavaScript Modules, which I have pulled right from their Git Hub and when my Angular app runs Quill.js errors out with this error: 但是,Quill使用JavaScript模块,我从他们的Git Hub中直接拉出了JavaScript,当我的Angular应用程序运行Quill.js错误时出现此错误:

笔芯导入错误

I know the reference is accurate, but I don't think Angular knows how to handle the references. 我知道引用是正确的,但是我不认为Angular知道如何处理引用。 I am trying to edit the open source code of Quill locally and test my changes, but I can not get my app to compile correctly. 我正在尝试在本地编辑Quill的开源代码并测试我的更改,但无法使我的应用正确编译。 What I am missing here? 我在这里想念的是什么?

You have two options: 您有两种选择:

  1. add the script to your index.html file 将脚本添加到您的index.html文件
  2. Add it in the .angular-cli.json file in apps:[ "scripts: [] ] for example: 将其添加到以下apps:[ "scripts: [] ]的.angular-cli.json文件中apps:[ "scripts: [] ] ,例如:

    apps: [ "scripts": [ "./Quill/Quill.js" ] ] 应用程序:[“脚本”:[“ ./Quill/Quill.js”]]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM