I am following this tutorial, basically copy all the code
https://developers.google.com/maps/documentation/javascript/tutorial
but got an error saying that the initMap function is not a function. I am using angularjs in my project, could that be causing problems?
I copied the same code into plunker and it works just fine... What are the possible issues?
Actually the error is being generated by the initMap in the Google's api script
<script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"> </script>
so basically when the Google Map API is loaded then the initMap function is executed. If you don't have an initMap function, then the initMap is not a function error is generated.
So basically what you have to do is one of the following options:
&callback=angular.noop
if you just want an empty function() (only if you use angular)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With