我正在尝试制作一个应用程序,以便用户能够单击链接(链接是位置),它将打开谷歌地图并将他们引导到该位置。我有以下代码:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<meta charset="utf-8">
<title>ECC</title>
</head>
<body ng-app="app">
<div ng-controller="firstCtrl">
<input type="text" ng-model="search"/>
<ul>
<li ng-repeat="site in SiteLocs |filter : search ">{{site.name}}</li>
</ul>
</div>
</body>
</html>
JS
var app = angular.module('app', []);
app.controller('firstCtrl', function($scope){
$scope.SiteLocs = [
{
"name": "502 Nelson St, Greenville, MS 38701",
"visibility": "0",
"description": "502 Nelson St, Greenville, MS 38701",
"styleUrl": "#waypoint",
"Point": {
"coordinates": "-91.05636,33.415485,0"
}
}
,
{
"name": "242 Blackhawk Trace, Galena, IL 61036",
"visibility": "0",
"description": "242 Blackhawk Trace, Galena, IL 61036",
"styleUrl": "#waypoint",
"Point": {
"coordinates": "-90.319778,42.390862,0"
}
}, (ect... there are a couple thousand of these so I wont add them all..)
];
});
我需要帮助的是链接它的自身。我不知道使用 href 将列表链接到什么。大家有什么想法吗?
最佳答案
我已经弄清楚了。这真的很简单。
<body>
<div ng-controller="firstCtrl">
<input type="text" ng-model="search" border="1"/>
<ul>
<li ng-repeat="site in SiteLocs |filter : search "><a href="http://maps.google.com/?q=" +
{{site.Point.coordinates}}>{{site.name}}</a></li>
</ul>
</div>
</body>
关于javascript - Google map 的 KML 坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24701371/