`[$injector:nomod] Module 'google-maps' is not avail
`[$injector:nomod] Module 'google-maps' is not available`
我使用angular-google-maps来处理angular应用程序中的google地图。为此,我必须将angular-google-maps.js
添加到项目中。如果我以以下方式添加脚本,页面工作没有任何错误:
<script type="text/javascript"
src="http://www.directiv.es/application/html/js/nlaplante/angular-google-maps/angular-google-maps.js"></script>
但是如果我使用本地复制,它将不起作用,像这样:
<script type="text/javascript"
src="js/libs/directiv.es/angular-google-maps.js"></script>
查看firebug,我看到angular-google-maps.js
文件被加载了,但是在这种情况下,发生了以下错误:
Uncaught Error: [$injector:modulerr] Failed to instantiate module mapsApp due to:
Error: [$injector:modulerr] Failed to instantiate module google-maps due to:
Error: [$injector:nomod] Module 'google-maps' is not available! You either misspelled the...<omitted>...1)
在网上搜索了几个小时,我没有找到任何原因或解决方案。也许你有一个想法或提示,如何找到原因? 我找到了解决方案,我想把它写在这里的情况下,有人遇到同样的问题。
在我的例子中,我从github下载了angular-google-maps扩展,在windows上提取压缩文件并复制到我的项目中。结果,一个错误发生:Failed to instantiate module google-maps due to ...
而加载"相同"的js文件在http一切工作正常。关键是:这不是同一个文件!
解决方案是从URL链接获取文件并将其存储在本地:
可能在下载或解压缩过程中,zip文件被破坏。也许是性格问题。无论什么。
如果我在浏览器中打开链接http://www.directiv.es/application/html/js/nlaplante/angular-google-maps/angular-google-maps.js
,我可以右键单击该文件并在"源代码"编辑器中打开源代码并将该文件保存在磁盘上。
现在我可以将新创建的文件复制到我的项目文件夹中,如该位置:js/libs/directiv.es/angular-google-maps.js
,一切正常.....
相关文章:
- 单击超链接时,如何使用Google Maps API v3缩放地图
- 使用Google Maps API向标记添加多个字符
- Google Maps API OverlayView()在AngularJS指令中不起作用
- 使用Google Maps API驱动时间多边形
- 使用Google Maps JavaScript API v3和Geocoding API映射多个位置
- 在for循环中使用多维数组设置google.maps.Marker图标
- 可扩展的画布作为Google Maps Javascript API中的覆盖
- 在自动完成中使用Google Maps Places API;API不工作
- google.maps.event.addDomListener(window, 'load', fun
- 根据PHP中数组的长度在Google Maps API中循环遍历标记
- 加载Google MAPS API v3的JSON数据
- 如何使用Dojo引用Google Maps事件中的包含类
- Javascript:Google Maps API:如果地图加载在隐藏容器中,则为空白地图
- 如何在Ionic/Codova应用程序中保护我的Google Maps Javascript V3 API密钥
- “google.maps.MapTypeId is undefined”在FF 14中使用GMAP3时
- Google Maps Javascript API is not loading
- Google Maps Places API: TypeError: autocomplete is undefined
- IE8中的Google Maps API加载失败(“Google'is undefined”)
- google maps js v3 xml is null
- `[$injector:nomod] Module 'google-maps' is not avail