在angularjs应用程序中添加地图

时间:2016-11-08 04:58:29

标签: javascript html angularjs html5 google-maps

我正在尝试通过添加以下脚本标记在我的angularjs应用程序中添加谷歌地图: -

 <script src="https://maps.googleapis.com/maps/api/js?key=[AddingMySecretKeyHere]&callback=initMap" async defer></script>

我从https://developers.google.com/maps/documentation/javascript/adding-a-google-map

读到

但是我在建设它时会遇到错误

[10:13:46] Starting 'custom-templates'...
[10:13:47] Finished 'custom-less' after 29 ms

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: Path G:\DemoProjects\firstWebApp\src\https:\maps.goo
gleapis.com\maps\api\js not found!
    at getFiles (G:\DemoProjects\firstWebApp\node_modules\g
ulp-usemin\lib\blocksBuilder.js:64:15)
    at module.exports (G:\DemoProjects\firstWebApp\node_mod
ules\gulp-usemin\lib\blocksBuilder.js:111:22)
    at Transform._transform (G:\DemoProjects\firstWebApp\no
de_modules\gulp-usemin\index.js:16:22)
    at Transform._read (G:\DemoProjects\firstWebApp\node_mo
dules\gulp-usemin\node_modules\through2\node_modules\readable-stream\lib\_stream
_transform.js:184:10)
    at Transform._write (G:\DemoProjects\firstWebApp\node_m
odules\gulp-usemin\node_modules\through2\node_modules\readable-stream\lib\_strea
m_transform.js:172:12)
    at doWrite (G:\DemoProjects\firstWebApp\node_modules\gu
lp-usemin\node_modules\through2\node_modules\readable-stream\lib\_stream_writabl
e.js:237:10)
    at writeOrBuffer (G:\DemoProjects\firstWebApp\node_modu
les\gulp-usemin\node_modules\through2\node_modules\readable-stream\lib\_stream_w
ritable.js:227:5)
    at Transform.Writable.write (G:\DemoProjects\ambuhelp-hospita
l\node_modules\gulp-usemin\node_modules\through2\node_modules\readable-stream\li
b\_stream_writable.js:194:11)
    at write (G:\DemoProjects\firstWebApp\node_modules\viny
l-fs\node_modules\readable-stream\lib\_stream_readable.js:623:24)
    at flow (G:\DemoProjects\firstWebApp\node_modules\vinyl
-fs\node_modules\readable-stream\lib\_stream_readable.js:632:7)

我是新手,因此无法确定哪里出错了!请帮助。

1 个答案:

答案 0 :(得分:0)

仅使用

<script src="http://maps.google.com/maps/api/js?key=[AddingMySecretKeyHere]?sensor=false"></script>

没有&lt; async defer&gt;