I am using an external API built with javascript, and I need to call some functions on js file.
My main file are in src/asssets/openlayers/scripts/main.js
I imported them all on index.html, like
<script src="/assets/openlayers/scripts/libs/jquery-1.10.2.min.js"></script>
<script src="/assets/openlayers/scripts/libs/jquery-ui-1.10.3.custom/jquery-ui-1.10.3.custom.min.js"></script>
<script src="/assets/openlayers/scripts/libs/proj4js-1.1.0/proj4js-compressed.js"></script>
<script src="/assets/openlayers/scripts/libs/OpenLayers-2.13.1/OpenLayers.js"></script>
<script src="/assets/openlayers/scripts/main.js"></script>
<script src="/assets/openlayers/scripts/classes/event.js"></script>
<script src="/assets/openlayers/scripts/classes/drawing.js"></script>
<script src="/assets/openlayers/scripts/classes/culturesDrawing.js"></script>
<script src="/assets/openlayers/scripts/classes/cultureMarkerDrawing.js"></script>
<script src="/assets/openlayers/scripts/map/map.initialize.js"></script>
<script src="/assets/openlayers/scripts/map/map.js"></script>
<script src="/assets/openlayers/scripts/map/map.tool.js"></script>
<script src="/assets/openlayers/scripts/map/map.tools.js"></script>
<script src="/assets/openlayers/scripts/map/map.cookies.js"></script>
<script src="/assets/openlayers/scripts/map/map.custom.controls.js"></script>
<script src="/assets/openlayers/scripts/map/map.contextmenu.js"></script>
<script src="/assets/openlayers/scripts/map/map.info.js"></script>
<script src="/assets/openlayers/scripts/map/map.drawingLayer.js"></script>
<script src="/assets/openlayers/scripts/map/map.layerStyle.js"></script>
<script src="/assets/openlayers/scripts/map/map.spatialLayer.js"></script>
<script src="/assets/openlayers/scripts/map/map.rasterLayer.js"></script>
<script src="/assets/openlayers/scripts/map/map.Legend.js"></script>
<script src="/assets/openlayers/scripts/map/map.rasterLegend.js"></script>
<script src="/assets/openlayers/scripts/map/map.layerSwitcher.js"></script>
<script src="/assets/openlayers/scripts/map/map.tooltip.js"></script>
<script src="/assets/openlayers/scripts/map/map.obsolete.js"></script>
But now I need to call some fucntions that I have on main.js. How can I achieve this on my .ts file. I dont want to declare each function on the ts file like
declare var drawGauge: any;
import { Component, Input, OnInit } from '@angular/core';
@Component({
selector: 'app-geospacial-map',
templateUrl: './geospatial-map.component.html',
styleUrls: ['./geospatial-map.component.scss'],
})
export class GeospacialMapComponent implements OnInit {
constructor() {}
ngOnInit(): void {
}
}
It's possible to access everything from file globaly? Sry for my bad expression, it's a lot of stuff, just ask me if you need more explanation