0

我在 ionicV1 项目中使用传单路由机(liedman)。我按照教程做了一切,我得到了错误

L. 未定义

我读了其他关于在标签之间放置传单链接的帖子,我做了一切。

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/leaflet@1.0.3/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链接

<script src="js/app.js"></script>
<!--<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js">
</script>-->
<script src="https://unpkg.com/leaflet@1.0.3/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>-->

标签

<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);

我评论了其他链接,因为我尝试了一切但仍然没有弄清楚,我从 2 天开始就陷入了这个 BASIC 问题。任何人 ?

4

1 回答 1

1

在您的应用程序代码之前加载传单。

代替

<script src="js/app.js"></script>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>

做类似的事情

<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="js/app.js"></script>
于 2017-10-05T08:37:28.423 回答