类型错误:window.initMap 不是函数 [英] TypeError: window.initMap is not a function

查看:32
本文介绍了类型错误:window.initMap 不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注这个教程,基本上是复制所有代码

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.

这篇关于类型错误:window.initMap 不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆