我正在尝试使用以下代码让 angularjs-google-maps 在 angularjs 项目中显示地图。(仅显示相关的代码部分。)
在 index.html 中:
<script src="http://rawgit.com/allenhwkim/angularjs-google-maps/master/build/scripts/ng-map.min.js"></script>
在 app.js 中:
var forecastApp = angular.module('forecastApp', ['ngRoute', 'ngResource', 'ngSanitize','angularjs-dropdown-multiselect','ngMap']);
...
.when('/map',
{
controller:'mapController',
templateUrl:'app/map/_map.html'
})
在 _map.html 中:
<div map-lazy-load="http://maps.google.com/maps/api/js">
<map center="current-location" zoom="8">
<info-window position="current-location" visible="true">
<span>Loation found using HTML5.</span>
</info-window>
</map>
</div>
mapController.js 中的 mapController 已实例化且为空。
在 Firefox 中,我得到一些无限循环,数百个导航栏相互叠加,直到崩溃,在 Chrome 中,我得到超时而没有显示任何内容(只是等待 rawgit.com)并设法获得“超出堆栈大小”错误一次,可能表示循环引用?谷歌地图的延迟实例化不是问题,“等待...”显示了为下载 js/css 代码访问的最后一个域,因此服务器没有关闭(尝试包括本地存储的 ng-map.min.js也)。
谢谢你。