I have a question about Angular (v4) and external jQuery plugin. I worked with this jQuery plugin before but with asp.net not Angular. My jQuery plugin consists of 3 elements:
- Folder with plugin files (css, js files)
- Div element that I need to add on my page (
<div id="mapsvg"></div>
) - jQuery function that I need to add on page and call when page loads (
$('#mapsvg').mapSvg({source: '/maps/usa.svg'});
)
I'm using jQuery plugin from this site: http://mapsvg.com/documentation/jquery/
My question is how can I add this plugin to my Angular project? I tried to do that in new blank project but it does not work.
At this moment I:
- Added references to script in angular.json ->
"./src/assets/mapsvg/js/mapsvg.js"
- declare variable in app.component.ts ->
declare var $: any;
- add div element into app.component.html
Right now I receive an error in console that my usa.svg file is not found (404). When I move the svg file into src folder it shows on page but all plugin functionality are not working.
Could anybody please help me with this implementation?