I can't use javascript libraries on dashboard designer
-
Hi!
I'm trying to add a library this way<script src="**cdn link or js file path**" type="text/javascript"></script>
Library cannot be defined in mango although it works in html file
Just a example: i want to import jquery but I get an error like this $ is not defined -
The only way to do this is duplicate the /opt/mango/web/modules/MangoUI/web/index.html file to /opt/mango/overrides/web/modules/MangoUI/web/index.html and add your desired external libraries yourself if you're doing your own thing.
Secondly jquery is already part of the mangoUI stack. You shouldn't have to add it."jquery": "^3.3.1", "jquery-ui": "^1.12.1", "jquery-ui-touch-punch-c": "^1.4.0",
What are you trying to achieve?
-
@mattfox said in I can't use javascript libraries on dashboard designer:
shouldn't
Firstly thank you for your response,
Can I use jquery or leaflet js or anything part of the mango in the script tag on dashboard designer? Not in Angular scope btw.
my goal is not jquery but when i try to test it,it's not work. -
No, the whole purpose of the mangoUI system is it's an AngularJS single page application. If you want to write custom scripts you will have to write either AngularJS controllers or full blown components using the userModule option.
There are a multitude of resources in this forum to accomplish this. If it's of any benefit, I use mapboxGLjs myself so I could probably help you get started with leaflet.
Sorry it's not the news you wanted to hear, but it's how this system is designed...Fox
-
@mattfox I know how I can do it now at least. Thank you for your help :)
-
Hi @erdi-metin Just BTW Mango Automation already has a map component based on leaflet.
You can view the API documents at HTTP://localhost/ui/docs/ng-mango/ma-tile-map