2

我刚刚通过 bower 将 angular-google-maps 更新到 2.0.1 并添加了所需的依赖项(bluebird、jquery、loadash)。当我注释掉 google-maps 时,我的应用程序运行良好。所以它肯定与 angular-google-maps 有关

bower.json 依赖项:

"dependencies": {
    "angular-route": "~1.2.21",
    "angular-sanitize": "~1.2.21",
    "angular-strap": "~2.0.5",
    "angular-animate": "~1.2.21",
    "angular-resource": "~1.2.21",
    "underscore": "~1.6.0",
    "angular": "~1.2.21",
    "jquery": "~2.1.1",
    "bootstrap": "~3.2.0",
    "angular-bootstrap": "~0.11.0",
    "angular-google-maps": "~2.0.1"
  }

这是加载的库:

<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<script src="/bower_components/underscore/underscore.js"></script>
<script src="/bower_components/lodash/dist/lodash.underscore.min.js"></script>
<script src="/bower_components/bluebird/js/browser/bluebird.js"></script>
<script src="/bower_components/angular/angular.min.js"></script>
<script src="/bower_components/angular-route/angular-route.min.js"></script>
<script src="/bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script src="/bower_components/angular-resource/angular-resource.min.js"></script>
<script src="/bower_components/angular-animate/angular-animate.min.js"></script>
<script src="/bower_components/angular-google-maps/dist/angular-google-maps.min.js"></script>
<script src="/bower_components/angular-loading-bar/build/loading-bar.min.js"></script>
<script src="/bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
<script src="/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
<script src="bower_components/angular-ui-utils/ui-utils.js"></script>
<script src="bower_components/angular-translate/angular-translate.min.js"></script>
<script src="bower_components/angular-dialogs/angular-dialog.min.js"></script>
<script src="/bower_components/angular-i18n/angular-locale_de.js"></script>

在这里我加载我的应用程序:

  var app = angular.module('app', [
    'ngRoute',
    'ngSanitize',
    'ngResource',
    'ngAnimate',
    'google-maps', // when I take this out, my app works... 
    'angular-loading-bar',
    'ui.bootstrap',
    'ui.utils',
    'AppControllers',
    'AppFactories',
    'AppDirectives',
  ]);

app.config(['GoogleMapApiProvider'.ns(), function (GoogleMapApi) {
        GoogleMapApi.configure({
            key: '*********',
            v: '3.17',
            libraries: 'weather,geometry,visualization'
        });
  }]);

我得到的错误信息:

Failed to instantiate module app due to:
Error: [$injector:modulerr] http://errors.angularjs.org/1.2.26/$injector/modulerr?p0=...)
    at Error (native)
    at http://localhost:8000/bower_components/angular/angular.min.js:6:450
    at http://localhost:8000/bower_components/angular/angular.min.js:34:97
    at r (http://localhost:8000/bower_components/angular/angular.min.js:7:290)
    at e (http://localhost:8000/bower_components/angular/angular.min.js:33:207)
    at http://localhost:8000/bower_components/angular/angular.min.js:33:284
    at r (http://localhost:8000/bower_components/angular/angular.min.js:7:290)
    at e (http://localhost:8000/bower_components/angular/angular.min.js:33:207)
    at gc (http://localhost:8000/bower_components/angular/angular.min.js:36:309)
    at c (http://localhost:8000/bower_components/angular/angular.min.js:18:170

我真的不知道是什么破坏了模块,我检查了我的凉亭链接,更新了所有依赖项(凉亭更新)。

我一直在尝试找出错误,但没有运气。也许有人可以在这里帮助我。谢谢!

4

2 回答 2

2

他们更改了模块名称,因此对其进行了更新:

var app = angular.module('app', [
    'ngRoute',
    'ngSanitize',
    'ngResource',
    'ngAnimate',
    'google-maps'.ns(), // new namespace
    'angular-loading-bar',
    'ui.bootstrap',
    'ui.utils',
    'AppControllers',
    'AppFactories',
    'AppDirectives',
  ]);

作为第 4 点的更新。https://angular-ui.github.io/angular-google-maps/#!/use

于 2014-10-19T16:35:14.253 回答
0
var app = angular.module('app', ['uiGmapgoogle-maps']);
于 2015-10-13T09:53:09.887 回答