【问题标题】:Using angular-google-places-autocomplete使用 angular-google-places-autocomplete
【发布时间】:2016-09-10 10:41:35
【问题描述】:

在我的项目中使用 angular-google-places-autocomplete 来自动完成地点

bower install angular-google-places-autocomplete

在控制台中显示错误

Global `google` var missing. Did you forget to include the places API script?

在 index.html 中手动遵循脚本下方包含的 kuhnza/angular-google-places-autocomplete 文档

<script src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>

然后一切正常,但是当移动到生产应用程序时,使用grunt build 构建,然后创建缩小和丑化文件,同样的错误再次出现。 我认为在构建应用程序期间删除了手动添加的脚本。 如何解决这个问题。如何正确地在应用程序中包含这个 google 地方 api。在此先感谢

【问题讨论】:

    标签: javascript angularjs google-maps autocomplete gruntjs


    【解决方案1】:

    您需要在 index.html 声明中的 build:js 之前移动您的脚本以进行 google api 调用

    【讨论】:

      猜你喜欢
      • 2014-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-09
      • 2017-01-23
      • 1970-01-01
      • 2018-12-30
      相关资源
      最近更新 更多