Angular google maps error:- Uncaught Error: Google Maps API not available

Angular google maps error:- Uncaught Error: Google Maps API not available

我是 Ionic 应用程序开发的新手。我使用 bower

安装了 angular google 地图
bower install angularjs-google-maps

然后在 index.html

中添加了这些参考文件
<script src="lib/lodash/dist/lodash.js"></script>
<!-- ionic/angularjs js -->
<script src="cordova.js"></script>
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/angular-simple-logger/dist/angular-simple-logger.min.js"></script>
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyB52Z0xUP6JEX9fjr1EEQvCWgo8W4DD5CY&extension=.js"></script>

<script src="lib/angularjs-google-maps/dist/angularjs-google-maps.js"></script>

最终将 gm 模块添加为您的 AngularJS 应用程序的依赖项:

angular.module('taskerApp', ['ionic', 'taskerApp.controllers', 'taskerApp.services', 'pickadate', 'gm'])

显示空白屏幕并在控制台中给出此错误。

angularjs-google-maps.js:40 Uncaught Error: Google Maps API not available, please make sure the Google Maps library is loaded before the AngularJS Google Maps library is loaded

请帮我解决这个问题。

根据文档:

Make sure to load the AngularJS library and the Google Maps API:

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<script src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>

Then load the AngularJS Google Maps library:

<script src="bower/angularjs-google-maps/dist/angularjs-google-maps.js"></script>

Finally add the gm module as a dependency to your AngularJS app:

angular.module('yourApp', ['gm']);

That's it! You can now start adding Google Maps directives to your markup.

我猜你没有按正确的顺序包含文件。