很抱歉问这个愚蠢的问题。我正在尝试将 ionic 中的 pathfinding.js ( https://github.com/qiao/PathFinding.js/ ) 用于我的 navigation.html 页面(位于 www/templates/目录中的部分文件),但它不能使用部分文件,除了 index.html 根文件。但是,如果我在 index.html 根文件中使用它,它会给我错误,可能是因为它需要在 navigation.html 页面中绘制一个 svg,但它找不到 navigation.html 页面,因为它在索引中。 html (依赖于 navigation.html)
我想用bower,但是bower能解决这个问题吗?
最佳答案
在索引文件中添加脚本标签以添加脚本。
<script src="./templates/PathFinding.js/"
>`
它将被加载。
但是,如果您使用 Bower.. Bower 只会将文件下载到 src
文件夹 .. 那么您需要手动将脚本的脚本标签添加到 index.html
中.
关于javascript - 如何在 ionic 应用程序中包含 javascript 第三方库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41477831/