0

I am new in Ionic app development. I installed angular google maps using bower

bower install angularjs-google-maps

then added these ref files in 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>

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

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

It is showing a blank screen and giving this error in console.

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

Please help me resolve this.

1 Answer 1

1

As per the docs:

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.

My guess is you don’t include the files in the right order.

Sign up to request clarification or add additional context in comments.

1 Comment

Order as you can see is same as shown here but it helped me as a copy pasted "<script src="maps.googleapis.com/maps/api/…> " the problem causing the error was missing "libraries=places" in url

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.