我试过,但我得到这样的错误......
ReferenceError: google is not defined
at eval (eval at <anonymous> (http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js:2:2536), <anonymous>:15:1)
at eval (native)
at Function.n.extend.globalEval (http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js:2:2536)
at n.fn.extend.domManip (http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js:3:17188)
at n.fn.extend.append (http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js:3:14846)
at m (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:136:287)
at Object.enter (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:136:235)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:158:3
at http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:100:347
at i (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:79:437)
maps.googleapis.com/maps/api/js?v=3&sensor=true&_=1420810087262:8
Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
这是我的HTML代码...使用ng-include
包含地图<html>
...
<div ng-include="'map.html'"></div>
...
</html>
这是我的地图代码...(map.html)
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&sensor=true"></script>
<script>
function initialize()
{
var mapOptions = {
zoom: 19,
center: new google.maps.LatLng(12.994866,80.201111),
mapTypeId:google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById('googleMap'),
mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div id="googleMap" style="width:350px;height:200px;"></div>
我该怎么办? 请帮帮我......