简体   繁体   中英

How to include javascript third party library in ionic app?

I am sorry to ask this silly question. I am trying to use pathfinding.js ( https://github.com/qiao/PathFinding.js/ ) in ionic for my navigation.html page (a partial file located in the www/templates/ directory) but it's not working with partials files except with index.html root file only. However, it gives me error if I use it in the index.html root file, maybe because it needs to draw a svg in the navigation.html page, but it could not find the navigation.html page since it is in the index.html (dependency with the navigation.html)

I am thinking to use bower, but can bower solve this problem?

In index file add the script tag to add scripts.

<script src="./templates/PathFinding.js/" >`

It will get loaded.

However, if you use Bower.. Bower will only download the files to src folder .. then you need to manually add script tags for script into the index.html .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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