gpt4 book ai didi

javascript - 实例化模块时使用angular-google-maps和错误

转载 作者:行者123 更新时间:2023-11-29 10:43:56 35 4
gpt4 key购买 nike

我正在使用 http://angular-google-maps.org/在我的项目中。

添加到我的项目的步骤是:http://angular-google-maps.org/use .

当我运行我的项目时,浏览器显示:

Uncaught Error: [$injector:modulerr] Failed to instantiate module BeLiga due to:
Error: [$injector:modulerr] Failed to instantiate module BeLiga.ligaControllers due to:
Error: [$injector:modulerr] Failed to instantiate module google-map due to:
Err...<omitted>...1)

当我写的时候问题来了:

var moduloMap = angular.module('myController', ['google-maps']);

我已经检查了所有内容,但找不到问题。

是的!

最佳答案

问题是脚本的加载顺序:

示例未运行:

 <script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;language=en"></script> 
<script src="lib/angular/underscore.js"></script>
<script src="lib/angular/angular-google-maps.min.js"></script>

<script src="lib/angular/angular.js"></script>
<script src="lib/angular/angular-route.js"></script>
<script src="lib/angular/angular-sanitize.min.js"></script>
<script src="lib/angular/angular-animate.js"></script>
<script src="js/app.js"></script>
<script src="js/services.js"></script>
<script src="js/animations.js"></script>

运行示例:

    <script src="lib/angular/angular.js"></script>
<script src="lib/angular/angular-route.js"></script>
<script src="lib/angular/angular-sanitize.min.js"></script>
<script src="lib/angular/angular-animate.js"></script>
<script src="js/app.js"></script>
<script src="js/services.js"></script>
<script src="js/animations.js"></script>

<script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;language=en"></script>
<script src="lib/angular/underscore.js"></script>
<script src="lib/angular/angular-google-maps.min.js"></script>

如您所见,问题是脚本的顺序是一个愚蠢的错误,但我没有意识到,这让我浪费了很多时间。

如果有人可以为他服务,我留下答案。

问候和感谢。

关于javascript - 实例化模块时使用angular-google-maps和错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23317492/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com