Reputation: 41
i am using leaflet routing machine(liedman) in ionicV1 project. I did everything according to tutorial, i got error
I read other post about put leaflet link between tag, i did everything.
CSS
<link href="css/style.css" rel="stylesheet">
<!--<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-
0.7.3/leaflet.css" />-->
<link rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<!--<link rel="stylesheet" href="lib/leaflet/dist/leaflet.css"/>-->
<!--<link rel="stylesheet" href="lib/leaflet-routing-machine-
3.2.5/dist/leaflet-routing-machine.css"/>-->
<link rel="stylesheet" href="leaflet-routing-machine.css"/>
JS link
<script src="js/app.js"></script>
<!--<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js">
</script>-->
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<!--<script src="lib/leaflet-routing-machine-3.2.5/dist/leaflet-routing-
machine.js"></script>-->
<!--<script src="lib/leaflet/dist/leaflet.js"></script>-->
tag
<div id="map" class="map"></div>
<!--<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js">
</script>-->
<!--<script src="lib/leaflet-routing-machine-3.2.5/dist/leaflet-routing-
machine.js"></script>-->
<script src="leaflet-routing-machine.js"></script>
aap.js
var map = L.map('map').setView([57,74, 11.949], 10);;
var map= L.tileLayer('Company server link, this link working fine', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
L.Routing.control({
waypoints: [
L.latLng(57.74, 11.94),
L.latLng(57.6792, 11.949)
],
routeWhileDragging: true
}).addTo(map);
I commented other link , because i try everything but still not figure it out, i am stuck in this BASIC problem since 2 days. Anyone ?
Upvotes: 1
Views: 1276
Reputation: 19049
Load Leaflet before your application code.
Instead of
<script src="js/app.js"></script>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
Do something like
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="js/app.js"></script>
Upvotes: 2