Hey everyone, I need some help:
I recently integrated the Google Maps API into my AngularJs project and encountered an error in the console:
Uncaught
message: "initMap is not a function"
name: "InvalidValueError"
This occurs when the Google Map API is loaded and tries to execute the initMap function. I figured out that if I don't have an initMap function defined, the error is thrown. Makes sense!
To resolve this issue, I added a global initMap function to my main JavaScript file and the problem disappeared!
Can someone please explain why adding a global initMap function solved the problem? Is it the right approach or is there a better solution? Thank you!