谷歌地图错误 - 未捕获的 ReferenceError:谷歌未定义 - yeoman [英] google map error - Uncaught ReferenceError: google is not defined - yeoman

查看:30
本文介绍了谷歌地图错误 - 未捕获的 ReferenceError:谷歌未定义 - yeoman的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 yeoman-ionic 框架上,我尝试将谷歌地图添加到我的应用程序中.问题是每次我运行 grunt 服务时,index.html 脚本都被删除了.所以我运行了这个:bower install --save angular-google-maps 问题解决了,因为它在 index.html 之外的其他文件上编写了脚本.唯一的问题是当我再次运行 grunt serve 时出现了不同的错误,从那时起我就无法弄清楚我做错了什么......

on the yeoman-ionic framework i've tried to add google map to my app.the problem was that every time i ran grunt serve the index.html scripts got deleted. so i've ran this:bower install --save angular-google-maps and the problem solved since it wrote the scripts on some other file in addition to index.html. the only problem is when i ran grunt serve againt i got a diffrent error and ever since then i just can't figure out what i am doing wrong...

错误:

未捕获的引用错误:未定义 google

Uncaught ReferenceError: google is not defined

我认为这与某些 karma 配置文件有关,尽管我不知道这是什么.试图解决这个问题几个小时,但无法解决这个问题...

i think it has something to do with some karma config file although i have no idea what this is. tried to solve this for a couple of hours and couldn't figure this out...

推荐答案

我也遇到了这个错误.原来这与我加载脚本文件的顺序有关.尝试按以下顺序加载您的脚本文件:

I was getting that error too. It turned out to be related to the order in which I loaded my script files. Try loading your script files in this order:

<script src='//maps.googleapis.com/maps/api/js?sensor=false'></script>
<script src='/path/to/underscore[.min].js'></script>
<script src='/path/to/lodash.underscore[.min].js'></script>
<script src='/path/to/angular-google-maps[.min].js'></script>

最好!

这篇关于谷歌地图错误 - 未捕获的 ReferenceError:谷歌未定义 - yeoman的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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