gpt4 book ai didi

javascript - Angular-Google-Maps 库未加载

转载 作者:搜寻专家 更新时间:2023-10-31 23:23:43 24 4
gpt4 key购买 nike

我的应用程序使用 angularjs 和 Node ,我想在我的应用程序中集成谷歌地图。我使用这组指令 http://angular-ui.github.io/angular-google-maps/#!/ ,

出现的问题是这样的:

Uncaught Error: [$injector:modulerr]    h  ttp://errors.angularjs.org/1.6.2/$injector/modulerr?p0=VisualiseATM&p1=Err…    at%20Mc%20(http%3A%2F%2Flocalhost%3A3000%2Flib%2Fangular.min.js%3A21%3A332)
at angular.min.js:6
at angular.min.js:41
at q (angular.min.js:7)
at g (angular.min.js:40)
at db (angular.min.js:45)
at c (angular.min.js:21)
at Mc (angular.min.js:21)
at qe (angular.min.js:20)
at angular.min.js:331
at HTMLDocument.b (angular.min.js:37)

具体来说,问题在于:

Module 'uiGmapgoogle-maps' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

这是我的 Angular 代码:

var app = angular.module("VisualiseATM", [ 'uiGmapgoogle-maps',
'ui.router'
, 'controllers'
, 'ngCookies'
, ]);

app.config(function(uiGmapGoogleMapApiProvider) {
uiGmapGoogleMapApiProvider.configure({
key: 'MY_API_KEY',
v: '3.20', //defaults to latest 3.X anyhow
libraries: 'weather,geometry,visualization'
});
})

app.config(['uiGmapGoogleMapApiProvider', function(GoogleMapApiProviders) {
GoogleMapApiProviders.configure({
china: true
});
}]
);

我在互联网上找到了这个,但我不确定如何在我的应用程序中使用它。 https://github.com/angular-ui/angular-google-maps/issues/1489

我知道我必须使用这个 angular-simple-logger,但不知道如何将它与我的代码集成。

我希望你能给我一个答案。非常感谢!

最佳答案

不再维护 Angular-Google-Maps

改为使用 AngularJS-Google-Maps

<script src="https://maps.google.com/maps/api/js?libraries=placeses,visualization,drawing,geometry,places"></script>
<script src="https://unpkg.com/angular/angular.js"></script>
<script src="https://unpkg.com/ngmap"></script>

DEMO on PLNKR


或者使用 Angular-Google-Maps 旧版本 2.1.6。它不需要 angular-simple-logger:

  <head>
<script src="//unpkg.com/angular/angular.js"></script>
<script src="//unpkg.com/angular-google-maps@2.1.6"></script>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>

<body ng-app="app">
<h1>Angular Google Maps</h1>
</body>

DEMO on PLNKR .

Angular-Google-Maps

Project No longer actively maintained

With angular 2 and other competing projects we have decided to announce that this project is no longer activley maintained. If someone desires to take over the project please contact any of the admins.

As a warning this project is not activley watched by the admins and is checked [from time to time] to fix any major issues. Therefore if something is major, contact someone directly via mentioning a users name/alias (will notify the user/admin).

Alternatives:

— GitHub Angular-Google-Maps

关于javascript - Angular-Google-Maps 库未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43034819/

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