【问题标题】:KML Coordinates for Google Maps谷歌地图的 KML 坐标
【发布时间】:2014-07-11 15:30:24
【问题描述】:

我正在尝试制作一个应用程序,以便用户能够单击链接(链接是位置),它将打开谷歌地图并将它们定向到该位置。我有以下代码:

<!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。有人有什么想法吗?

【问题讨论】:

  • 好的,那你有什么问题?你真的没有问问题。你的代码不工作吗?或者你不知道如何实现你想要的?没有人会给你完整的代码来做你所要求的,但他们会很乐意帮助你解决你遇到的问题,
  • 抱歉含糊不清。当我将 放入代码中时,我不知道将其链接到什么才能将其链接到谷歌地图。
  • 然后将其编辑到您的问题中。

标签: javascript html arrays angularjs google-maps


【解决方案1】:

我已经弄明白了。真的很简单。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-08
    • 2015-02-05
    • 2012-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多