使用Angular Js从地址数组中使用多个标记Google Map API v3

时间:2015-04-14 15:50:03

标签: javascript angularjs google-maps google-maps-api-3

我必须使用角度js从地址数组中实现多标记功能。

这是我的小提琴:

http://jsfiddle.net/cVsdp/175/

但是我收到以下错误:

Uncaught Error: [$injector:modulerr] Failed to instantiate module MyApp 

任何人都可以帮助我。

2 个答案:

答案 0 :(得分:0)

您可以将JSFiddle设置从onLoad更改为No wrap - in <body>

enter image description here

请参阅工作示例:http://jsfiddle.net/cVsdp/179/

修改 另外,更改行

map = new google.maps.Map(angular.element(document.querySelector("#map_canvas")[0]), myOptions);

以下内容:

map = new google.maps.Map(document.querySelector("#map_canvas"), myOptions);

工作的JSFiddle:http://jsfiddle.net/cVsdp/180/

enter image description here

答案 1 :(得分:0)

在互联网上有这么多的例子,但在大多数例子中,纬度和经度已经在这些数据库中可用。

以下示例获取地址数组并在Google地图上放置多个标记。

工作示例:

jsfiddle :http://jsfiddle.net/cVsdp/182/