单张路由机。 L未定义(IonicV1)

时间:2017-10-04 12:35:34

标签: angularjs leaflet leaflet-routing-machine ionic-v1

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

http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html

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

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问题。任何人 ?

1 个答案:

答案 0 :(得分: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>