我正在使用 angular-google-maps 在角度应用程序中处理谷歌地图。为此,我必须添加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>
看着萤火虫,我看到了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 上提取该 zip 文件并将该文件复制到我的项目中。结果,出现错误:Failed to instantiate module google-maps due to ...
通过 http 加载“相同的”js 文件时一切正常。重点是:这不是同一个文件!
解决方案是从 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
一切正常......
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)