TypeError:window.initMap不是一个函数 [英] TypeError: window.initMap is not a function
问题描述
我正在学习本教程,基本上复制了所有的代码。
https://developers.google.com/maps/documentation/javascript/tutorial
但出现错误,说明initMap函数不是一个函数。
我在我的项目中使用了angularjs,是否会导致问题?
我将相同的代码复制到plunker中,它工作得很好...
有什么可能的问题?
事实证明它与 ng-Route
加载脚本的顺序
写了一个指令,并将API脚本放在所有工作的顶部。
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?
turns out it has to do with ng-Route
and the order of loading script
wrote a directive and put the API script on top of everything works.
这篇关于TypeError:window.initMap不是一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!